def test_invalid(self): prop = bcpd.Date() assert not prop.is_valid(1.0+1.0j) assert not prop.is_valid(()) assert not prop.is_valid([]) assert not prop.is_valid({}) assert not prop.is_valid(_TestHasProps()) assert not prop.is_valid(_TestModel())
def test_invalid(self) -> None: prop = bcpd.Date() assert not prop.is_valid(datetime.datetime(2020, 1, 11)) assert not prop.is_valid("") assert not prop.is_valid(False) assert not prop.is_valid(True) assert not prop.is_valid(1.0 + 1.0j) assert not prop.is_valid(()) assert not prop.is_valid([]) assert not prop.is_valid({}) assert not prop.is_valid(_TestHasProps()) assert not prop.is_valid(_TestModel())
def test_valid(self): prop = bcpd.Date() assert prop.is_valid(None) assert prop.is_valid(0) assert prop.is_valid(1) assert prop.is_valid(0.0) assert prop.is_valid(1.0) # TODO (bev) should check actual convertibility assert prop.is_valid("") # TODO (bev) should fail assert prop.is_valid(False) assert prop.is_valid(True)
def test_str(self): prop = bcpd.Date() assert str(prop) == "Date"
def test_has_ref(self): prop = bcpd.Date() assert not prop.has_ref
def test_transform_milliseconds(self): t = time.time() * 1000 prop = bcpd.Date() assert prop.transform(t) == datetime.date.today()
def test_valid(self) -> None: prop = bcpd.Date() assert prop.is_valid(datetime.date(2020, 1, 11)) assert prop.is_valid("2020-01-10")