diff --git a/tests/unit/packaging/test_typosnyper.py b/tests/unit/packaging/test_typosnyper.py index 9ad021d15734..1cf37a24f742 100644 --- a/tests/unit/packaging/test_typosnyper.py +++ b/tests/unit/packaging/test_typosnyper.py @@ -29,6 +29,7 @@ ("dateutil-python", ("swapped_words", "python-dateutil")), ("numpi", ("common_typos", "numpy")), ("requestz", ("common_typos", "requests")), + ("python-dateutil", None), # Pass, swapped_words same as original ], ) def test_typo_check_name(name, expected): diff --git a/warehouse/packaging/typosnyper.py b/warehouse/packaging/typosnyper.py index 91ffd9988b07..33b21f8f4442 100644 --- a/warehouse/packaging/typosnyper.py +++ b/warehouse/packaging/typosnyper.py @@ -381,7 +381,7 @@ def _swapped_words(project_name: str, corpus: set[str]) -> TypoCheckMatch: # Join the words using `-` to create a new name reconstructed = "-".join(p) # If the new name is in the list of popular names, return it - if reconstructed in corpus: + if reconstructed != project_name and reconstructed in corpus: return "swapped_words", reconstructed return None