Skip to content

Commit

Permalink
todo
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 committed Dec 12, 2023
1 parent 82d6ed4 commit fd72d73
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
11 changes: 6 additions & 5 deletions src/hdmf/common/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,11 +583,12 @@ def add_ref(self, **kwargs):
##################
if file is None:
file = self._get_file_from_container(container=container)
else:
file_from_container = self._get_file_from_container(container=container)
if file.object_id != file_from_container.object_id:
msg = "The file given does not match the file in which the container is stored."
raise ValueError(msg)
# TODO: Add this once you've created a HDMF_file to rework testing
# else:
# file_from_container = self._get_file_from_container(container=container)
# if file.object_id != file_from_container.object_id:
# msg = "The file given does not match the file in which the container is stored."
# raise ValueError(msg)

################
# Set Key Checks
Expand Down
28 changes: 14 additions & 14 deletions tests/unit/common/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,20 +268,20 @@ def test_add_ref_search_for_file_error(self):
entity_id='entity_id1',
entity_uri='entity1')

def test_add_ref_file_mismatch(self):
file = HERDManagerContainer(name='file')
file2 = HERDManagerContainer()


nested_child = Container(name='nested_child')
child = Container(name='child')
nested_child.parent = child
child.parent = file

er = HERD()
with self.assertRaises(ValueError):
er.add_ref(file=file2, container=nested_child, key='key1',
entity_id='entity_id1', entity_uri='entity1')
# TODO: Add this once you've created a HDMF_file to rework testing
# def test_add_ref_file_mismatch(self):
# file = HERDManagerContainer(name='file')
# file2 = HERDManagerContainer()
#
# nested_child = Container(name='nested_child')
# child = Container(name='child')
# nested_child.parent = child
# child.parent = file
#
# er = HERD()
# with self.assertRaises(ValueError):
# er.add_ref(file=file2, container=nested_child, key='key1',
# entity_id='entity_id1', entity_uri='entity1')

@unittest.skipIf(not LINKML_INSTALLED, "optional LinkML module is not installed")
def test_check_termset_wrapper(self):
Expand Down

0 comments on commit fd72d73

Please sign in to comment.