Closed cochiseruhulessin closed 6 years ago
Sigh, using assert statements was a phase I went through that I'm still trying to recover from.
I think you might be using an older version...
$ python3 -OO
>>> import dsnparse
>>> dsnparse.parse('a')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/jaymon/Projects/dsnparse/_dsnparse/dsnparse.py", line 289, in parse
r = parse_class(dsn, **defaults)
File "/Users/jaymon/Projects/dsnparse/_dsnparse/dsnparse.py", line 104, in __init__
kwargs = self.parse(dsn, **defaults)
File "/Users/jaymon/Projects/dsnparse/_dsnparse/dsnparse.py", line 42, in parse
raise ValueError("{dsn} is invalid, only full dsn urls (scheme://host...) allowed".format(dsn=dsn))
ValueError: a is invalid, only full dsn urls (scheme://host...) allowed
>>>
>>> dsnparse.__version__
'0.1.11'
Upgrading your version should fix this as I refactored all the assert
checks to use ValueError
instead.
When running Python with the -OO optimizations, assert statements are ignored. This causes different behavior in the
parse()
function.With the
-OO
flags: