Skip to content

Commit

Permalink
Fix add_extension for None
Browse files Browse the repository at this point in the history
  • Loading branch information
IanCa committed May 20, 2024
1 parent 56524c9 commit c02af7f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hed/scripts/script_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/scripts/test_script_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit c02af7f

Please sign in to comment.