Esempio n. 1
0
class LineParsing(unittest.TestCase):
    values = [
        ("home work", commute.Header("home", "work")),
        ("# A comment", None),
        ("#abc", None),
        ("f home train 15", commute.FlexRoute("home", "train", "15")),
        ("t north_berkeley 7:15 millbrae 8:11 ",
         commute.TimedRoute("north_berkeley", "7:15", "millbrae", "8:11")),
    ]

    def test_line_parsing(self):
        for line, expected in self.values:
            actual = commute.parse(line)
            self.assertEqual(actual, expected)
Esempio n. 2
0
 def test_mixed_prio(self):
     l = [
         commute.FlexRoute("home", "bart", "15"),
         commute.TimedRoute("north_berkeley", "7:15", "millbrae", "8:11")
     ]
     self.assertEqual(l, sorted(l))
Esempio n. 3
0
 def test_timedroute_prio(self):
     l = [
         commute.TimedRoute("north_berkeley", "7:15", "millbrae", "8:11"),
         commute.TimedRoute("north_berkeley", "8:15", "millbrae", "9:11")
     ]
     self.assertEqual(l, sorted(l))
Esempio n. 4
0
 def test_premote_from_dest_ts(self):
     t = self.f.promote(end_ts=self.ts)
     self.assertEqual(t, commute.TimedRoute("home", "11:45", "bart",
                                            "12:00"))
Esempio n. 5
0
 def test_premote_from_begin_ts(self):
     t = self.f.promote(begin_ts=self.ts)
     self.assertEqual(t, commute.TimedRoute("home", "12:00", "bart",
                                            "12:15"))