Skip to content

Commit ec13999

Browse files
committed
Add regression tests for is_conjunction/is_prefix/is_suffix list fallthrough
Previous list-argument tests only covered lists containing a match, so they never exercised the no-match fall-through path that raised AttributeError.
1 parent c2636cf commit ec13999

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/test_python_api.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,30 @@ def test_is_prefix_with_list(self) -> None:
286286
self.assertTrue(hn.is_prefix(items))
287287
self.assertTrue(hn.is_prefix(items[1:]))
288288

289+
def test_is_prefix_with_list_no_match(self) -> None:
290+
hn = HumanName()
291+
self.assertFalse(hn.is_prefix(['firstname', 'lastname']))
292+
289293
def test_is_conjunction_with_list(self) -> None:
290294
hn = HumanName()
291295
items = ['firstname', 'lastname', 'and']
292296
self.assertTrue(hn.is_conjunction(items))
293297
self.assertTrue(hn.is_conjunction(items[1:]))
294298

299+
def test_is_conjunction_with_list_no_match(self) -> None:
300+
hn = HumanName()
301+
self.assertFalse(hn.is_conjunction(['firstname', 'lastname']))
302+
303+
def test_is_suffix_with_list(self) -> None:
304+
hn = HumanName()
305+
items = ['firstname', 'lastname', 'jr']
306+
self.assertTrue(hn.is_suffix(items))
307+
self.assertTrue(hn.is_suffix(items[1:]))
308+
309+
def test_is_suffix_with_list_no_match(self) -> None:
310+
hn = HumanName()
311+
self.assertFalse(hn.is_suffix(['firstname', 'lastname']))
312+
295313
def test_override_constants(self) -> None:
296314
C = Constants()
297315
hn = HumanName(constants=C)

0 commit comments

Comments
 (0)