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
# Debug how a specific name string is parsed (prints HumanName repr)
18
-
python tests.py"Dr. Juan Q. Xavier de la Vega III"
19
+
python -m nameparser"Dr. Juan Q. Xavier de la Vega III"
19
20
20
21
# Build docs
21
22
sphinx-build -b html docs dist/docs
@@ -65,6 +66,6 @@ Parse flow:
65
66
66
67
Each named attribute (`title`, `first`, etc.) is a `@property` that joins its corresponding `_list`. Setters call `_set_list()` which runs the value through `parse_pieces()`, so assigning `hn.last = "de la Vega"` correctly re-parses prefix tokens.
67
68
68
-
### Tests (`tests.py`)
69
+
### Tests (`tests/`)
69
70
70
-
All tests live in a single file. `HumanNameTestBase.m()` is a custom assert helper that prints the original name string on failure. Many test classes group cases by name format type. `TEST_NAMES` is a list of name strings that gets automatically permuted into comma-separated variants as a regression check. When adding a new parsing case, add it to the relevant test class and consider adding the base form to `TEST_NAMES`.
71
+
Tests run under **pytest** and are split one file per concern (`tests/test_titles.py`, `tests/test_suffixes.py`, etc.). `tests/base.py` holds `HumanNameTestBase` — a plain (non-`unittest`) base whose `m()`helper is a custom assert that prints the original name string on failure (plus thin `assert*` shims so the moved test bodies are unchanged). `tests/conftest.py` defines an autouse fixture that runs **every test twice** — once with `empty_attribute_default = ''` and once with `None` — so reported counts are doubled (e.g. 11 methods → 22 results); it also snapshots/restores the scalar `CONSTANTS` config around each test to keep tests order-independent. `TEST_NAMES`(in `tests/test_variations.py`) is a list of name strings permuted into comma-separated variants as a regression check. Tests that should fail use `@pytest.mark.xfail`. When adding a parsing case, add it to the relevant `tests/test_*.py` file and consider adding the base form to `TEST_NAMES`.
Copy file name to clipboardExpand all lines: docs/release_log.rst
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
Release Log
2
2
===========
3
+
* Unreleased
4
+
- Fix ``initials()`` interpolating the literal ``None`` for empty name parts when ``empty_attribute_default = None`` (e.g. ``"J. None D."``); empty parts now render as an empty string and a fully-empty result returns ``empty_attribute_default``
5
+
- Add ``python -m nameparser "Name String"`` command-line helper that prints a parsed name
6
+
- Reorganize the test suite from a single ``tests.py`` into a ``tests/`` pytest package
3
7
* 1.2.0 - June 11, 2026
4
8
- Drop Python 2 and Python < 3.10 support; Python 3.10–3.14 now required
5
9
- Add type hints and type declarations (PEP 561 ``py.typed`` marker)
0 commit comments