import unittest import tagtimerc class TestTagTimeRc(unittest.TestCase): def test_parse_tagtimerc(self): test_rc = "./tests/tagtimerc" ttrc = tagtimerc.parse_tagtimerc(test_rc) self.assertEqual(ttrc.log_file, "/home/auser/dev/TagTime/auser.log") self.assertEqual(ttrc.ed, "/usr/bin/vim +") self.assertEqual(ttrc.xt, "/usr/bin/st") self.assertEqual(ttrc.retrothresh, 60) self.assertEqual(ttrc.gap, 45 * 60) self.assertEqual(ttrc.urping, 1184097393) self.assertEqual(ttrc.seed, 11193462) self.assertEqual(ttrc.linelen, 79) self.assertEqual(ttrc.catchup, 1) def test_value_to_int(self): value_to_int = tagtimerc.value_to_int self.assertEqual(value_to_int("312"), 312) with self.assertRaises(ValueError): value_to_int("") self.assertEqual(value_to_int("12 * 3*2"), 72)