Skip to content

Commit

Permalink
Merge pull request #958 from IanCa/develop
Browse files Browse the repository at this point in the history
Fix script_util tests
  • Loading branch information
VisLab authored Jun 14, 2024
2 parents f2b7e9a + 258b1ab commit 1bf82d4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/schema/test_hed_schema_io_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_saving_default_schemas(self):
reloaded_schema = load_schema(self.output_folder + "test_8.tsv")
self.assertEqual(schema, reloaded_schema)

schema = load_schema_version("score_1.1.1")
schema = load_schema_version("score_1.1.0")
schema.save_as_dataframes(self.output_folder + "test_score.tsv", save_merged=True)

reloaded_schema = load_schema(self.output_folder + "test_score.tsv")
Expand Down
32 changes: 32 additions & 0 deletions tests/scripts/test_script_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,38 @@ def test_none_extension(self):


class TestSortBaseSchemas(unittest.TestCase):
TEST_DIR = 'test_directory'

@classmethod
def setUpClass(cls):
if not os.path.exists(cls.TEST_DIR):
os.makedirs(cls.TEST_DIR)
os.chdir(cls.TEST_DIR)
cls.create_stub_files()

@classmethod
def tearDownClass(cls):
os.chdir('..')
shutil.rmtree(cls.TEST_DIR)

@classmethod
def create_stub_files(cls):
filenames = [
"test_schema.mediawiki",
os.path.normpath("hedtsv/test_schema/test_schema_Tag.tsv"),
"other_schema.xml",
os.path.normpath("hedtsv/wrong_folder/wrong_name_Tag.tsv"),
os.path.normpath("prerelease/hedtsv/test_schema/test_schema_Tag.tsv"),
os.path.normpath("not_hedtsv/test_schema/test_schema_Tag.tsv")
]
for filename in filenames:
filepath = os.path.normpath(filename)
directory = os.path.dirname(filepath)
if directory:
os.makedirs(directory, exist_ok=True)
with open(filepath, 'w') as f:
f.write('') # Create an empty file

def test_mixed_file_types(self):
filenames = [
"test_schema.mediawiki",
Expand Down

0 comments on commit 1bf82d4

Please sign in to comment.