You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if not isinstance(fqdn, str):
raise ValueError("fqdn must be str")
Since isinstance(None, str) is valid python and returns False.
Which gives the following behaviour that I think is correct:
Python 3.12.2 (tags/v3.12.2:6abddd9, Feb 6 2024, 21:26:36) [MSC v.1937 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from fqdn import FQDN
>>> a = FQDN('')
>>> a.is_valid
False
>>> b = FQDN()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: FQDN.__init__() missing 1 required positional argument: 'fqdn'
>>> c = FQDN(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\shane.kearns\Documents\git\prappspec\tests\.virtualenv\Lib\site-packages\fqdn\__init__.py", line 44, in __init__
raise ValueError("fqdn must be str")
ValueError: fqdn must be str
The text was updated successfully, but these errors were encountered:
The empty string is already treated as invalid by the supplied
validators. It was incorrect to raise ValueError on construction since
this requires users to pre-validate strings before passing to a
validation library.
Fixesypcrts#45
A ValueError is raised here if passing the empty string
''
since it is a false value.fqdn/fqdn/__init__.py
Line 43 in 8429006
The correct line should read:
Since
isinstance(None, str)
is valid python and returns False.Which gives the following behaviour that I think is correct:
The text was updated successfully, but these errors were encountered: