Пример #1
0
    def test_date_or_none(self):
        assert times.Date_or_None('1969-01-01') == date(1969, 1, 1)
        assert times.Date_or_None('2015-01-01') == date(2015, 1, 1)
        assert times.Date_or_None('2015-12-13') == date(2015, 12, 13)

        assert times.Date_or_None('') is None
        assert times.Date_or_None('fail') is None
        assert times.Date_or_None('2015-12') is None
        assert times.Date_or_None('2015-12-40') is None
        assert times.Date_or_None('0000-00-00') is None
    def test_date_or_none(self):
        assert times.Date_or_None("1969-01-01") == date(1969, 1, 1)
        assert times.Date_or_None("2015-01-01") == date(2015, 1, 1)
        assert times.Date_or_None("2015-12-13") == date(2015, 12, 13)

        assert times.Date_or_None("") is None
        assert times.Date_or_None("fail") is None
        assert times.Date_or_None("2015-12") is None
        assert times.Date_or_None("2015-12-40") is None
        assert times.Date_or_None("0000-00-00") is None