From 2cc2dbe952f1e7fdcf05cf723546b30262af4591 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Sat, 9 Dec 2023 12:20:35 +0300 Subject: [PATCH] tests: apply fixes from fixit RewriteToLiteral: It's slower to call list() than using the empty literal --- tests/test_check.py | 20 ++++++++++---------- tests/test_fix.py | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/test_check.py b/tests/test_check.py index 6b2113b..ce7268b 100644 --- a/tests/test_check.py +++ b/tests/test_check.py @@ -257,7 +257,7 @@ def test_check_incorrect_iso_639_1_language(capsys): title = "A randomised vaccine field trial in Kenya demonstrates protection against wildebeest-associated malignant catarrhal fever in cattle" language = "es" - exclude = list() + exclude = [] # Create a dictionary to mimic Pandas series row = {"dc.title": title, "dc.language.iso": language} @@ -277,7 +277,7 @@ def test_check_incorrect_iso_639_3_language(capsys): title = "A randomised vaccine field trial in Kenya demonstrates protection against wildebeest-associated malignant catarrhal fever in cattle" language = "spa" - exclude = list() + exclude = [] # Create a dictionary to mimic Pandas series row = {"dc.title": title, "dc.language.iso": language} @@ -297,7 +297,7 @@ def test_check_correct_iso_639_1_language(): title = "A randomised vaccine field trial in Kenya demonstrates protection against wildebeest-associated malignant catarrhal fever in cattle" language = "en" - exclude = list() + exclude = [] # Create a dictionary to mimic Pandas series row = {"dc.title": title, "dc.language.iso": language} @@ -313,7 +313,7 @@ def test_check_correct_iso_639_3_language(): title = "A randomised vaccine field trial in Kenya demonstrates protection against wildebeest-associated malignant catarrhal fever in cattle" language = "eng" - exclude = list() + exclude = [] # Create a dictionary to mimic Pandas series row = {"dc.title": title, "dc.language.iso": language} @@ -407,7 +407,7 @@ def test_check_doi_field(): # the citation and a DOI field. d = {"cg.identifier.doi": doi, "dcterms.bibliographicCitation": citation} series = pd.Series(data=d) - exclude = list() + exclude = [] result = check.citation_doi(series, exclude) @@ -418,7 +418,7 @@ def test_check_doi_only_in_citation(capsys): """Test an item with a DOI in its citation, but no DOI field.""" citation = "Orth, A. 2021. Testing all the things. doi: 10.1186/1743-422X-9-218" - exclude = list() + exclude = [] # Emulate a column in a transposed dataframe (which is just a series), with # an empty DOI field and a citation containing a DOI. @@ -439,7 +439,7 @@ def test_title_in_citation(): title = "Testing all the things" citation = "Orth, A. 2021. Testing all the things." - exclude = list() + exclude = [] # Emulate a column in a transposed dataframe (which is just a series), with # the title and citation. @@ -456,7 +456,7 @@ def test_title_not_in_citation(capsys): title = "Testing all the things" citation = "Orth, A. 2021. Testing all teh things." - exclude = list() + exclude = [] # Emulate a column in a transposed dataframe (which is just a series), with # the title and citation. @@ -477,7 +477,7 @@ def test_country_matches_region(): country = "Kenya" region = "Eastern Africa" - exclude = list() + exclude = [] # Emulate a column in a transposed dataframe (which is just a series) d = {"cg.coverage.country": country, "cg.coverage.region": region} @@ -495,7 +495,7 @@ def test_country_not_matching_region(capsys): country = "Kenya" region = "" missing_region = "Eastern Africa" - exclude = list() + exclude = [] # Emulate a column in a transposed dataframe (which is just a series) d = { diff --git a/tests/test_fix.py b/tests/test_fix.py index 4f88b16..f8d95c1 100644 --- a/tests/test_fix.py +++ b/tests/test_fix.py @@ -131,7 +131,7 @@ def test_fix_country_not_matching_region(): country = "Kenya" region = "" missing_region = "Eastern Africa" - exclude = list() + exclude = [] # Emulate a column in a transposed dataframe (which is just a series) d = {