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
Fix bugs hidden in untested parser paths; remove vestigial unparsable
Auditing the 11 uncovered lines in parser.py (98% coverage) turned up
three real bugs, dead code, and a few untested-but-live paths:
- Fix __hash__ to lowercase like __eq__ does, so equal HumanName
instances hash equal and behave correctly in sets and dicts
- Fix initials() emitting a stray empty initial ("J. . V.") — or
raising TypeError when empty_attribute_default is None — for name
parts with no initialable words (e.g. prefix-only middle "de la");
deduplicate the per-group comprehensions into _initials_lists()
- Fix a trailing suffix being silently dropped after an empty comma
segment, e.g. "Doe, John,, Jr." losing the "Jr."
- Remove the unparsable attribute: the len(self) < 0 guard meant to
set it was unreachable, so it has reported False for every parsed
name since the earliest releases
- Remove __ne__ (Python 3 derives != from __eq__) and the two
unreachable "if not nxt" branches in the parse loops, which the
vacuously-true are_suffixes() check always preempts
- Rename __process_initial__ to _process_initial: dunder-both-sides
names are reserved for Python special methods
Adds dunder-contract, initials, and suffix regression tests; parser.py
is now at 100% statement coverage.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/release_log.rst
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,12 @@
1
1
Release Log
2
2
===========
3
3
* 1.3.0 - Unreleased
4
+
- Remove the vestigial ``unparsable`` attribute: the guard that was meant to set it was unreachable, so it has reported ``False`` for every parsed name since the earliest releases
5
+
- Fix ``__hash__`` to lowercase the name like ``__eq__`` does, so equal ``HumanName`` instances hash equal and behave correctly in sets and dicts
6
+
- Fix ``initials()`` emitting a stray empty initial (e.g. ``"J. . V."``) -- or raising ``TypeError`` when ``empty_attribute_default`` is ``None`` -- for name parts with no initialable words, e.g. a prefix-only middle name like ``"de la"``
7
+
- Fix a trailing suffix being silently dropped after an empty comma segment, e.g. ``"Doe, John,, Jr."`` losing the ``"Jr."``
8
+
- Remove ``__ne__``; Python 3 derives ``!=`` from ``__eq__`` automatically
9
+
- Change internal initials helper ``__process_initial__`` to ``_process_initial``: double-underscore-both-sides names are reserved for Python special methods; subclasses overriding the old name must rename their override
4
10
- Add ``non_first_name_prefixes`` to ``Constants``: a leading particle that is never a first name (e.g. ``"de Mesnil"``, ``"dos Santos"``) now parses as a surname with an empty first name, instead of treating the particle as the first name (closes #121)
5
11
- Add a first-class ``maiden`` field and ``maiden_delimiters`` to ``Constants``, so a delimiter (e.g. parenthesis) can be routed to ``maiden`` instead of ``nickname`` for alternate/maiden surnames, e.g. ``"Baker (Johnson), Jenny"`` (closes #22)
6
12
- Fix suffix-shaped parenthesized/quoted content (e.g. ``"(Ret)"``, ``"(MBA)"``) being misclassified as a nickname instead of a suffix (closes #111)
0 commit comments