def is_datetime(instance): if not isinstance(instance, (binary_type, text_type)): return False if DATETIME_HAS_RFC3339_VALIDATOR: return validate_rfc3339(instance) if DATETIME_HAS_ISODATE: return isodate.parse_datetime(instance) return True
def is_datetime(instance): if not isinstance(instance, (bytes, str)): return False if DATETIME_HAS_RFC3339_VALIDATOR: return validate_rfc3339(instance) if DATETIME_HAS_STRICT_RFC3339: return strict_rfc3339.validate_rfc3339(instance) if DATETIME_HAS_ISODATE: return isodate.parse_datetime(instance) return True
def is_datetime(instance): if not isinstance(instance, str): return True return validate_rfc3339(instance.upper())
def test_with_unicode(datetime_str): assert not validate_rfc3339(datetime_str)
def test_against_legacy(datetime_str): legacy_result = strict_rfc3339.validate_rfc3339(datetime_str) new_result = validate_rfc3339(datetime_str) assert legacy_result == new_result
def test_valid_dates(datetime_str): assert validate_rfc3339(datetime_str)
def is_datetime(instance: object) -> bool: if not isinstance(instance, str): return True return validate_rfc3339(instance.upper())