Example #1
0
    def test_920_subclass(self):
        class I(IsoCalendar):
            theAnswer = 42

            def __init__(self, *args, **kws):
                temp = kws.copy()
                self.extra = temp.pop('extra')
                IsoCalendar.__init__(self, *args, **temp)

            def newmeth(self, start):
                return start + self.year + self.week

        iso1 = IsoCalendar(2003, 14, 4)
        iso2 = I(2003, 14, 4, extra=7)

        assert iso2.theAnswer == 42
        assert iso2.extra == 7
        assert iso1.to_rata_die() == iso2.to_rata_die()
        assert iso2.newmeth(-7) == iso1.year + iso1.week - 7
    def test_920_subclass(self):

        class I(IsoCalendar):
            theAnswer = 42

            def __init__(self, *args, **kws):
                temp = kws.copy()
                self.extra = temp.pop('extra')
                IsoCalendar.__init__(self, *args, **temp)

            def newmeth(self, start):
                return start + self.year + self.week

        iso1 = IsoCalendar(2003, 14, 4)
        iso2 = I(2003, 14, 4, extra = 7)

        assert iso2.theAnswer == 42
        assert iso2.extra == 7
        assert iso1.to_rata_die() == iso2.to_rata_die()
        assert iso2.newmeth(-7) == iso1.year + iso1.week - 7