Fix formatting problems

This commit is contained in:
Raoul Snyman 2016-05-31 18:10:31 +02:00
parent 41dcf85cbe
commit 5a6c4f90a1
3 changed files with 22 additions and 2 deletions

View File

@ -134,6 +134,7 @@ def format_milliseconds(milliseconds):
:param milliseconds: Milliseconds to format :param milliseconds: Milliseconds to format
:return: Time string in format: hh.mm.ss,ttt :return: Time string in format: hh.mm.ss,ttt
""" """
milliseconds = int(milliseconds)
seconds, millis = divmod(milliseconds, 1000) seconds, millis = divmod(milliseconds, 1000)
minutes, seconds = divmod(seconds, 60) minutes, seconds = divmod(seconds, 60)
hours, minutes = divmod(minutes, 60) hours, minutes = divmod(minutes, 60)

View File

@ -407,7 +407,7 @@ class BibleMediaItem(MediaManagerItem):
self.initialise_chapter_verse(bible, first_book['name'], first_book['book_reference_id']) self.initialise_chapter_verse(bible, first_book['name'], first_book['book_reference_id'])
def initialise_chapter_verse(self, bible, book, book_ref_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) book = self.plugin.manager.get_book_by_id(bible, book_ref_id)
self.chapter_count = self.plugin.manager.get_chapter_count(bible, book) 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) verse_count = self.plugin.manager.get_verse_count_by_book_ref_id(bible, book_ref_id, 1)

View File

@ -25,7 +25,8 @@ Test the registry properties
from unittest import TestCase from unittest import TestCase
from openlp.core.common import Registry, RegistryProperties from openlp.core.common import Registry, RegistryProperties
from tests.functional import MagicMock
from tests.functional import MagicMock, patch
class TestRegistryProperties(TestCase, RegistryProperties): class TestRegistryProperties(TestCase, RegistryProperties):
@ -53,7 +54,25 @@ class TestRegistryProperties(TestCase, RegistryProperties):
""" """
# GIVEN an Empty Registry # GIVEN an Empty Registry
application = MagicMock() application = MagicMock()
# WHEN the application is registered # WHEN the application is registered
Registry().register('application', application) Registry().register('application', application)
# THEN the application should be none # THEN the application should be none
self.assertEqual(self.application, application, 'The application value should match') 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')