def test_datetime_format_with_datetime_format(): iso8601 = [fake.iso8601()] normal = [fake.date(pattern="%d-%m-%Y %H:%M:%S", end_datetime=None)] values = iso8601 + normal _paragraph = fake.paragraph_with_salt(values) extracted_values = extractors.datetime(_paragraph, fmt=None) assert compare_2_list(values, extracted_values)
def test_datetime_format_with_datetime_format_invalid_fmt(): value = fake.iso8601() with pytest.raises(ValueError): assert extractors.datetime(value, fmt=fake.word())
def test_datetime_format_with_datetime_format(): value = fake.iso8601() ret = validators.datetime(value, fmt=None) assert ret
def test_iso_8601_datetime_format_with_datetime_format_follow_iso_8601(): iso8601 = [fake.iso8601()] _paragraph = fake.paragraph_with_salt(iso8601) extracted_iso8601 = extractors.datetime(_paragraph, fmt='iso-8601') assert compare_2_list(iso8601, extracted_iso8601)
def test_iso_8601_datetime_format_with_datetime_format_follow_iso_8601(): value = fake.iso8601() ret = validators.datetime(value, fmt='iso-8601') assert ret