Exemplo n.º 1
0
 def test_parse_correction_ignores_bad_relative_times(self):
     timelog = TimeLog(StringIO(), datetime.time(2, 0))
     self.assertEqual(timelog.parse_correction("-200 did stuff"),
                      ("-200 did stuff", None))
Exemplo n.º 2
0
 def test_parse_correction_recognizes_relative_times(self):
     timelog = TimeLog(StringIO(), datetime.time(2, 0))
     self.assertEqual(timelog.parse_correction("-20 did stuff"),
                      ("did stuff", datetime.datetime(2015, 5, 12, 16, 7)))
Exemplo n.º 3
0
 def test_parse_correction_ignores_relative_times_before_last_entry(self):
     timelog = TimeLog(StringIO("2015-05-12 16:00: stuff"),
                       datetime.time(2, 0))
     self.assertEqual(timelog.parse_correction("-30 did stuff"),
                      ("-30 did stuff", None))
Exemplo n.º 4
0
 def test_parse_correction_handles_virtual_midnight_todays_time(self):
     timelog = TimeLog(StringIO(), datetime.time(2, 0))
     self.assertEqual(timelog.parse_correction("00:15 did stuff"),
                      ("did stuff", datetime.datetime(2015, 5, 13, 00, 15)))
Exemplo n.º 5
0
 def test_parse_correction_ignores_bad_absolute_times(self):
     timelog = TimeLog(StringIO(), datetime.time(2, 0))
     self.assertEqual(timelog.parse_correction("19:60 did stuff"),
                      ("19:60 did stuff", None))
     self.assertEqual(timelog.parse_correction("24:00 did stuff"),
                      ("24:00 did stuff", None))
Exemplo n.º 6
0
 def test_parse_correction_leaves_regular_text_alone(self):
     timelog = TimeLog(StringIO(), datetime.time(2, 0))
     self.assertEqual(timelog.parse_correction("did stuff"),
                      ("did stuff", None))
Exemplo n.º 7
0
 def test_parse_correction_handles_virtual_midnight_yesterdays_time(self):
     # Regression test for https://github.com/gtimelog/gtimelog/issues/33
     timelog = TimeLog(StringIO(), datetime.time(2, 0))
     self.assertEqual(timelog.parse_correction("15:20 did stuff"),
                      ("did stuff", datetime.datetime(2015, 5, 12, 15, 20)))
Exemplo n.º 8
0
 def test_parse_correction_ignores_relative_times_before_last_entry(self):
     timelog = TimeLog(StringIO("2015-05-12 16:00: stuff"),
                       datetime.time(2, 0))
     self.assertEqual(timelog.parse_correction("-30 did stuff"),
                      ("-30 did stuff", None))
Exemplo n.º 9
0
 def test_parse_correction_ignores_bad_relative_times(self):
     timelog = TimeLog(StringIO(), datetime.time(2, 0))
     self.assertEqual(timelog.parse_correction("-200 did stuff"),
                      ("-200 did stuff", None))
Exemplo n.º 10
0
 def test_parse_correction_recognizes_relative_times(self):
     timelog = TimeLog(StringIO(), datetime.time(2, 0))
     self.assertEqual(timelog.parse_correction("-20 did stuff"),
                      ("did stuff", datetime.datetime(2015, 5, 12, 16, 7)))
Exemplo n.º 11
0
 def test_parse_correction_ignores_bad_absolute_times(self):
     timelog = TimeLog(StringIO(), datetime.time(2, 0))
     self.assertEqual(timelog.parse_correction("19:60 did stuff"),
                      ("19:60 did stuff", None))
     self.assertEqual(timelog.parse_correction("24:00 did stuff"),
                      ("24:00 did stuff", None))
Exemplo n.º 12
0
 def test_parse_correction_handles_virtual_midnight_todays_time(self):
     timelog = TimeLog(StringIO(), datetime.time(2, 0))
     self.assertEqual(timelog.parse_correction("00:15 did stuff"),
                      ("did stuff", datetime.datetime(2015, 5, 13, 00, 15)))
Exemplo n.º 13
0
 def test_parse_correction_handles_virtual_midnight_yesterdays_time(self):
     # Regression test for https://github.com/gtimelog/gtimelog/issues/33
     timelog = TimeLog(StringIO(), datetime.time(2, 0))
     self.assertEqual(timelog.parse_correction("15:20 did stuff"),
                      ("did stuff", datetime.datetime(2015, 5, 12, 15, 20)))
Exemplo n.º 14
0
 def test_parse_correction_leaves_regular_text_alone(self):
     timelog = TimeLog(StringIO(), datetime.time(2, 0))
     self.assertEqual(timelog.parse_correction("did stuff"),
                      ("did stuff", None))