Skip to content
This repository was archived by the owner on Oct 17, 2024. It is now read-only.

Commit 1243b8e

Browse files
fix: Preserve implementation classifiers (#4)
* Add failing test * Fix
1 parent 622c56b commit 1243b8e

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

rust/src/project.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ fn generate_classifiers_to_entry(
212212
let mut count = 0;
213213
let delete = existing
214214
.iter()
215-
.filter(|e| e.starts_with("Programming Language :: Python :: ") && !must_have.contains(*e))
215+
.filter(|e| e.starts_with("Programming Language :: Python :: 3") && !must_have.contains(*e))
216216
.collect::<HashSet<&String>>();
217217
let mut to_insert = Vec::<SyntaxElement>::new();
218218
let mut delete_mode = false;
@@ -828,6 +828,34 @@ mod tests {
828828
true,
829829
(3, 8),
830830
)]
831+
#[case::project_preserve_implementation_classifiers(
832+
indoc ! {r#"
833+
[project]
834+
requires-python = ">=3.8"
835+
classifiers = [
836+
"License :: OSI Approved :: MIT License",
837+
"Topic :: Software Development :: Libraries :: Python Modules",
838+
"Programming Language :: Python :: Implementation :: CPython",
839+
"Programming Language :: Python :: Implementation :: PyPy",
840+
]
841+
"#},
842+
indoc ! {r#"
843+
[project]
844+
requires-python = ">=3.8"
845+
classifiers = [
846+
"License :: OSI Approved :: MIT License",
847+
"Programming Language :: Python :: 3 :: Only",
848+
"Programming Language :: Python :: 3.8",
849+
"Programming Language :: Python :: 3.9",
850+
"Programming Language :: Python :: 3.10",
851+
"Programming Language :: Python :: Implementation :: CPython",
852+
"Programming Language :: Python :: Implementation :: PyPy",
853+
"Topic :: Software Development :: Libraries :: Python Modules",
854+
]
855+
"#},
856+
true,
857+
(3, 10),
858+
)]
831859
fn test_format_project(
832860
#[case] start: &str,
833861
#[case] expected: &str,

0 commit comments

Comments
 (0)