Skip to content

Commit

Permalink
Merge pull request #892 from hed-standard/dev_fix_source_format
Browse files Browse the repository at this point in the history
Fix source_format when using a mix of xml/mediawiki sources
  • Loading branch information
VisLab authored Mar 27, 2024
2 parents 757d570 + 1dfa011 commit 0efe5b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hed/schema/schema_io/base2schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def _load(self):
if not self.appending_to_schema and self._schema.with_standard and not self._schema.merged:
from hed.schema.hed_schema_io import load_schema_version
saved_attr = self._schema.header_attributes
saved_format = self._schema.source_format
try:
base_version = load_schema_version(self._schema.with_standard)
except HedFileError as e:
Expand All @@ -115,6 +116,7 @@ def _load(self):
self._schema.filename = self.filename
self._schema.name = self.name # Manually set name here as we don't want to pass it to load_schema_version
self._schema.header_attributes = saved_attr
self._schema.source_format = saved_format
self._loading_merged = False

self._parse_data()
Expand Down
2 changes: 2 additions & 0 deletions tests/schema/test_schema_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def test_compare_schemas(self):

def test_compare_and_summarize_schemas_test(self):
schema1 = load_schema(os.path.join(self.base_data, "schema_compare.mediawiki"), name="Schema1")
self.assertEqual(schema1.source_format, ".mediawiki")
schema2 = load_schema(os.path.join(self.base_data, "schema_compare2.mediawiki"), name="Schema2")
self.assertEqual(schema2.source_format, ".mediawiki")

result = gather_schema_changes(schema1, schema2)
self.assertEqual(sum(len(x) for x in result.values()), 30)
Expand Down

0 comments on commit 0efe5b4

Please sign in to comment.