From 5a6c4f90a10600801c028e30d352f2fb7e64e4f6 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 31 May 2016 18:10:31 +0200 Subject: [PATCH] Fix formatting problems --- openlp/core/ui/media/__init__.py | 1 + openlp/plugins/bibles/lib/mediaitem.py | 2 +- .../test_registryproperties.py | 21 ++++++++++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/media/__init__.py b/openlp/core/ui/media/__init__.py index 9e2f61ae8..248aca6f2 100644 --- a/openlp/core/ui/media/__init__.py +++ b/openlp/core/ui/media/__init__.py @@ -134,6 +134,7 @@ def format_milliseconds(milliseconds): :param milliseconds: Milliseconds to format :return: Time string in format: hh.mm.ss,ttt """ + milliseconds = int(milliseconds) seconds, millis = divmod(milliseconds, 1000) minutes, seconds = divmod(seconds, 60) hours, minutes = divmod(minutes, 60) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index d6e7eb62e..d5304e867 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -407,7 +407,7 @@ class BibleMediaItem(MediaManagerItem): self.initialise_chapter_verse(bible, first_book['name'], first_book['book_reference_id']) def initialise_chapter_verse(self, bible, book, book_ref_id): - log.debug('initialise_chapter_verse {bible}, {book), {ref}'.format(bible=bible, book=book, ref=book_ref_id)) + log.debug('initialise_chapter_verse {bible}, {book}, {ref}'.format(bible=bible, book=book, ref=book_ref_id)) book = self.plugin.manager.get_book_by_id(bible, book_ref_id) self.chapter_count = self.plugin.manager.get_chapter_count(bible, book) verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(bible, book_ref_id, 1) diff --git a/tests/functional/openlp_core_common/test_registryproperties.py b/tests/functional/openlp_core_common/test_registryproperties.py index c9cf9c1c0..0f0184876 100644 --- a/tests/functional/openlp_core_common/test_registryproperties.py +++ b/tests/functional/openlp_core_common/test_registryproperties.py @@ -25,7 +25,8 @@ Test the registry properties from unittest import TestCase from openlp.core.common import Registry, RegistryProperties -from tests.functional import MagicMock + +from tests.functional import MagicMock, patch class TestRegistryProperties(TestCase, RegistryProperties): @@ -53,7 +54,25 @@ class TestRegistryProperties(TestCase, RegistryProperties): """ # GIVEN an Empty Registry application = MagicMock() + # WHEN the application is registered Registry().register('application', application) + # THEN the application should be none self.assertEqual(self.application, application, 'The application value should match') + + @patch('openlp.core.common.registryproperties.is_win') + def application_on_windows_test(self, mocked_is_win): + """ + Test property if registry value assigned on Windows + """ + # GIVEN an Empty Registry and we're on Windows + application = MagicMock() + mocked_is_win.return_value = True + + # WHEN the application is registered + Registry().register('application', application) + + # THEN the application should be none + self.assertEqual(self.application, application, 'The application value should match') +