Skip to content

Commit

Permalink
add test for setable time
Browse files Browse the repository at this point in the history
  • Loading branch information
Gil Brechbuhler committed Jul 25, 2016
1 parent 386da56 commit 10a5bd6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ebu_tt_live/clocks/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def set_fixed_time_mode(self, value):
"""
if not isinstance(value, bool):
raise TypeError
self.use_saved_time = value
self._use_fixed_time = value

def is_fixed_time_mode(self):
"""
Expand Down
17 changes: 17 additions & 0 deletions ebu_tt_live/clocks/test/test_base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

from unittest import TestCase
from ebu_tt_live.clocks.base import Clock
from datetime import timedelta


class TestLocalClock(TestCase):

def test_fixed_time_case(self):
clock = Clock()
test_time = timedelta(hours=1)
clock.set_fixed_time(test_time)
clock.set_fixed_time_mode(True)
self.assertEqual(clock.get_time(), test_time)
clock.set_fixed_time_mode(False)
self.assertRaises(NotImplementedError, lambda: clock.get_time())
self.assertRaises(TypeError, lambda: clock.set_fixed_time(1))

0 comments on commit 10a5bd6

Please sign in to comment.