From 2f2e47290b2a1e44ea1fdb83777bc9ff0052c445 Mon Sep 17 00:00:00 2001 From: IanCa Date: Tue, 4 Jun 2024 15:51:03 -0500 Subject: [PATCH] Fix tests on windows/with new 8.3 --- tests/schema/test_ontology_util.py | 2 +- tests/scripts/test_script_util.py | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/schema/test_ontology_util.py b/tests/schema/test_ontology_util.py index bcdd2b1d..de6111c8 100644 --- a/tests/schema/test_ontology_util.py +++ b/tests/schema/test_ontology_util.py @@ -150,7 +150,7 @@ def test_update_dataframes_from_schema(self): try: updated_dataframes = update_dataframes_from_schema(schema_dataframes_new, schema) except HedFileError as e: - self.assertEqual(len(e.issues), 111) + self.assertEqual(len(e.issues), 115) breakHere = 3 diff --git a/tests/scripts/test_script_util.py b/tests/scripts/test_script_util.py index 694a61bf..d4270360 100644 --- a/tests/scripts/test_script_util.py +++ b/tests/scripts/test_script_util.py @@ -15,9 +15,9 @@ def test_regular_extension(self): def test_tsv_extension(self): """Test that .tsv extensions are handled differently.""" # Assuming the function correctly handles paths with directories - self.assertEqual(add_extension("path/to/filename", ".tsv"), "path/to/hedtsv/filename") + self.assertEqual(add_extension(os.path.normpath("path/to/filename"), ".tsv"), os.path.normpath("path/to/hedtsv/filename")) # Testing with a basename only - self.assertEqual(add_extension("filename", ".tsv"), "hedtsv/filename") + self.assertEqual(add_extension("filename", ".tsv"), os.path.normpath("hedtsv/filename")) def test_empty_extension(self): """Test adding an empty extension.""" @@ -33,7 +33,7 @@ class TestSortBaseSchemas(unittest.TestCase): def test_mixed_file_types(self): filenames = [ "test_schema.mediawiki", - "hedtsv/test_schema/test_schema_Tag.tsv", + os.path.normpath("hedtsv/test_schema/test_schema_Tag.tsv"), "other_schema.xml" ] expected = { @@ -45,9 +45,9 @@ def test_mixed_file_types(self): def test_tsv_in_correct_subfolder(self): filenames = [ - "hedtsv/test_schema/test_schema_Tag.tsv", - "hedtsv/test_schema/test_schema_Tag.tsv", - "hedtsv/wrong_folder/wrong_name_Tag.tsv" # Should be ignored + os.path.normpath("hedtsv/test_schema/test_schema_Tag.tsv"), + os.path.normpath("hedtsv/test_schema/test_schema_Tag.tsv"), + os.path.normpath("hedtsv/wrong_folder/wrong_name_Tag.tsv") # Should be ignored ] expected = { "test_schema": {".tsv"} @@ -57,12 +57,12 @@ def test_tsv_in_correct_subfolder(self): def test_tsv_in_correct_subfolder2(self): filenames = [ - "prerelease/hedtsv/test_schema/test_schema_Tag.tsv", - "prerelease/hedtsv/test_schema/test_schema_Tag.tsv", - "prerelease/hedtsv/wrong_folder/wrong_name_Tag.tsv" # Should be ignored + os.path.normpath("prerelease/hedtsv/test_schema/test_schema_Tag.tsv"), + os.path.normpath("prerelease/hedtsv/test_schema/test_schema_Tag.tsv"), + os.path.normpath("prerelease/hedtsv/wrong_folder/wrong_name_Tag.tsv") # Should be ignored ] expected = { - "prerelease/test_schema": {".tsv"} + os.path.normpath("prerelease/test_schema"): {".tsv"} } result = sort_base_schemas(filenames) self.assertEqual(dict(result), expected) @@ -70,7 +70,7 @@ def test_tsv_in_correct_subfolder2(self): def test_ignored_files(self): filenames = [ "test_schema.mediawiki", - "not_hedtsv/test_schema/test_schema_Tag.tsv" # Should be ignored + os.path.normpath("not_hedtsv/test_schema/test_schema_Tag.tsv") # Should be ignored ] expected = { "test_schema": {".mediawiki"}