Skip to content

Commit 56c94ed

Browse files
derek73claude
andcommitted
Drop usage.rst doctest for empty parse; assert len==0 in test_len instead
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 13edf06 commit 56c94ed

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

docs/usage.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,6 @@ Empty or unparsable input does not raise an error; it produces a name whose
7878
attributes are all empty. Check ``len(name) == 0`` (or ``str(name) == ''``)
7979
to detect that nothing was parsed.
8080

81-
.. doctest::
82-
83-
>>> name = HumanName("")
84-
>>> len(name)
85-
0
86-
>>> str(name)
87-
''
88-
8981

9082
Capitalization Support
9183
----------------------

tests/test_python_api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ def test_len(self) -> None:
3636
self.m(len(hn), 5, hn)
3737
hn = HumanName("John Doe")
3838
self.m(len(hn), 2, hn)
39+
# empty input parses to an all-empty name; len == 0 is the
40+
# documented emptiness check (see usage.rst)
41+
self.assertEqual(len(HumanName("")), 0)
3942

4043
@pytest.mark.skipif(not dill, reason="requires python-dill module to test pickling")
4144
def test_config_pickle(self) -> None:

0 commit comments

Comments
 (0)