diff --git a/hed/scripts/script_util.py b/hed/scripts/script_util.py index 27841574..f94469b7 100644 --- a/hed/scripts/script_util.py +++ b/hed/scripts/script_util.py @@ -47,7 +47,7 @@ def validate_schema(file_path): def add_extension(basename, extension): """Generate the final name for a given extension. Only .tsv varies notably.""" - if extension.lower() == ".tsv": + if extension and extension.lower() == ".tsv": parent_path, basename = os.path.split(basename) return os.path.join(parent_path, "hedtsv", basename) return basename + extension diff --git a/tests/scripts/test_script_util.py b/tests/scripts/test_script_util.py index 5c8f1fb9..638ad5a8 100644 --- a/tests/scripts/test_script_util.py +++ b/tests/scripts/test_script_util.py @@ -25,7 +25,7 @@ def test_empty_extension(self): def test_none_extension(self): """Test behavior with None as extension.""" - with self.assertRaises(TypeError): + with self.assertRaises(AttributeError): add_extension("filename", None) class TestSortBaseSchemas(unittest.TestCase):