Skip to content

Commit

Permalink
add test code
Browse files Browse the repository at this point in the history
  • Loading branch information
yuji38kwmt authored and radoering committed May 8, 2023
1 parent c115710 commit dd9d40d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/fixtures/project_with_duplicated_classifiers/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[tool.poetry]
name = "project_with_duplicated_classifiers"
version = "1.2.3"
description = "This is a description"
authors = ["Your Name <[email protected]>"]
license = "MIT"

classifiers = [
# Duplicated classifiers
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Build Tools",
# The following classifiers are automatically generated
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]

[tool.poetry.dependencies]
python = "^3.8"
16 changes: 16 additions & 0 deletions tests/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,3 +478,19 @@ def test_create_dependency_marker_variants(
assert dep.python_versions == exp_python
assert dep.python_constraint == parse_constraint(exp_python)
assert str(dep.marker) == exp_marker


def test_all_classifiers_unique_even_if_classifiers_is_duplicated() -> None:
poetry = Factory().create_poetry(
fixtures_dir / "project_with_duplicated_classifiers"
)
package = poetry.package
assert package.all_classifiers == [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Software Development :: Build Tools",
]

0 comments on commit dd9d40d

Please sign in to comment.