Beispiel #1
0
    def test_MinMaxBounds_with_datetime(self):
        prop = bcpv.MinMaxBounds(accept_datetime=True)

        assert prop.is_valid((datetime.date(2012, 10,
                                            1), datetime.date(2012, 12, 2)))

        assert not prop.is_valid((datetime.date(2012, 10, 1), 22))
    def test_invalid_no_datetime(self):
        prop = bcpv.MinMaxBounds(accept_datetime=False)

        assert not prop.is_valid('string')
        assert not prop.is_valid(12)
        assert not prop.is_valid(('a', 'b'))
        assert not prop.is_valid((13, 12))
        assert not prop.is_valid((13.1, 12.2))
        assert not prop.is_valid((datetime.date(2012, 10, 1), datetime.date(2012, 12, 2)))
Beispiel #3
0
    def test_valid_no_datetime(self) -> None:
        prop = bcpv.MinMaxBounds(accept_datetime=False)

        assert prop.is_valid('auto')
        assert prop.is_valid((12, 13))
        assert prop.is_valid((-32, -13))
        assert prop.is_valid((12.1, 13.1))
        assert prop.is_valid((None, 13.1))
        assert prop.is_valid((-22, None))
 def test_str(self):
     prop = bcpv.MinMaxBounds()
     assert str(prop).startswith("MinMaxBounds(")
 def test_has_ref(self):
     prop = bcpv.MinMaxBounds()
     assert not prop.has_ref