Exemplo n.º 1
0
    def test_valid_line(self):
        fixture = [u"Name1, 20.10, 04/13/2010, ",
                   u"Name2, 21.01, 04/14/2010, 2w",]
        result = list(budget.schedule_parser_gen(fixture))
        expect = [budget.ScheduleItem(u"Name1",
                                      20.10,
                                      datetime(2010,4,13),
                                      u""),
                  budget.ScheduleItem(u"Name2",
                                      21.01,
                                      datetime(2010,4,14),
                                      u"2w"),]

        result = map(lambda x,y: cmp(x,y) == 0, result, expect)

        self.assertTrue(all(result), result)
Exemplo n.º 2
0
    def test_iter1(self):
        fixture = budget.ScheduleItem(u"Name",
                                      20.10,
                                      datetime(2010, 4, 13),
                                      u"2w")
        expect = [u"Name", 20.10, datetime(2010, 4, 13), u"2w"]
        result = list(fixture)

        self.assertEqual(result)
Exemplo n.º 3
0
    def test_unicode(self):
        fixture = budget.ScheduleItem(u"Name",
                                      20.10,
                                      datetime(2010, 4, 13),
                                      None)
        expect = u"Name, 20.1, 04/13/2010, "
        result = unicode(fixture)

        self.assertEqual(expect, result)
Exemplo n.º 4
0
    def test_until_withoutrrule(self):
        fixture = budget.ScheduleItem(u"Name",
                                      20.10,
                                      datetime(2010, 3, 5),
                                      u"")
        expect = [(u'Name', 20.10, datetime(2010, 3, 5)),]

        result = list(fixture.until(datetime(2010, 3, 19)))

        self.assertEqual(expect, result)
Exemplo n.º 5
0
    def test_comment(self):
        fixture = [u"# This is a comment",
                   u" # This is one as well",
                   u"",
                   u"   ",
                   u"Name1, 20.10, 04/13/2010, # Comment"]

        result = list(budget.schedule_parser_gen(fixture))
        expect = [budget.ScheduleItem(u"Name1",
                                      20.10,
                                      datetime(2010,4,13),
                                      u"")]
        self.assertEqual(expect, result)