diff --git a/test/test_authors.py b/test/test_authors.py index 5a169453..0488819b 100644 --- a/test/test_authors.py +++ b/test/test_authors.py @@ -16,6 +16,9 @@ SPLIT_AUTHORS_DATA = [ ("Red~Hot~Chili~Peppers", ("Red~Hot~Chili~Peppers", "")), ("The mamas~and~the~papas", ("mamas~and~the~papas", "The")), ("The mamas\ and\ the\ papas", ("mamas\ and\ the\ papas", "The")), + ("The mamas and the papas", ("mamas and the papas", "The")), # Unbreakable spaces + (r"\LaTeX command", ("command", r"\LaTeX")), # LaTeX commands are ignored + (r"\emph{Some braces}", ("braces}", r"\emph{Some")), # LaTeX commands are ignored ] PROCESS_AUTHORS_DATA = [ @@ -25,10 +28,27 @@ PROCESS_AUTHORS_DATA = [ ("Blake", "William"), ("Parry", "Hubert"), ("Royal\ Choir~of~FooBar", "The"), - ] - ), + ] + ), + ( + "Anonyme (1967)", + [], + ), + ( + "Lucky Luke et Jolly Jumper", + [ + ("Luke", "Lucky"), + ("Jumper", "Jolly"), + ], + ), ] +AUTHWORDS = authors.compile_authwords({ + "after": ["by"], + "ignore": ["anonymous", "Anonyme", "anonyme"], + "sep": ['and', 'et'], + }) + class TestAutors(unittest.TestCase): """Test of author parsing.""" @@ -41,13 +61,11 @@ class TestAutors(unittest.TestCase): for argument, expected in PROCESS_AUTHORS_DATA: with self.subTest(argument=argument, expected=expected): self.assertEqual( - authors.processauthors( - argument, - **authors.compile_authwords({ - "after": ["by"], - "ignore": ["anonymous"], - "sep": ['and'], - }) + set( + authors.processauthors( + argument, + **AUTHWORDS, + ) ), - expected + set(expected) )