jaraco / irc

Full-featured Python IRC library for Python.
MIT License
390 stars 84 forks source link

IRCFoldedCase no longer folding #213

Closed jaraco closed 10 months ago

jaraco commented 10 months ago

As revealed by the failing test:

___________________________________________________________ [doctest] irc.dict.IRCDict ____________________________________________________________
016 
017     >>> '[This]' in ''.join(d.keys())
018     True
019 
020     But the keys can be referenced with a different case
021 
022     >>> d['a'] == 'foo'
023     True
024 
025     >>> d['{this}'] == 'that'
UNEXPECTED EXCEPTION: KeyError('{this}')
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/doctest.py", line 1351, in __run
    exec(compile(example.source, filename, "single",
  File "<doctest irc.dict.IRCDict[3]>", line 1, in <module>
  File "/Users/jaraco/code/jaraco/irc/.tox/py/lib/python3.11/site-packages/jaraco/collections.py", line 356, in __getitem__
    return super(KeyTransformingDict, self).__getitem__(key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '{this}'
/Users/jaraco/code/jaraco/irc/irc/dict.py:25: UnexpectedException
_______________________________________________________ [doctest] irc.strings.IRCFoldedCase _______________________________________________________
007 
008     A version of FoldedCase that honors the IRC specification for lowercased
009     strings (RFC 1459).
010 
011     >>> IRCFoldedCase('Foo^').lower()
012     'foo~'
013 
014     >>> IRCFoldedCase('[this]') == IRCFoldedCase('{THIS}')
Expected:
    True
Got:
    False

/Users/jaraco/code/jaraco/irc/irc/strings.py:14: DocTestFailure

I expect the interface changed on jaraco.text.

jaraco commented 10 months ago

Indeed. jaraco.text switched from 'lower' to 'casefold' in 3.10.