Skip to content

Commit

Permalink
termset tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 committed Sep 19, 2023
1 parent ae6655a commit 86d5aa8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions src/hdmf/term_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def __init__(self, **kwargs):
def __validate(self):
# check if list, tuple, array, Data
from .container import Data # circular import fix
if isinstance(self.__value, (list, np.ndarray, tuple, Data)): # TODO: Future ticket on DataIO support
if isinstance(self.__value, (list, np.ndarray, tuple)): # TODO: Future ticket on DataIO support
values = self.__value
# create list if none of those
else:
Expand Down Expand Up @@ -228,13 +228,14 @@ def field_name(self):
def dtype(self):
return self.__getattr__('dtype')

def __getattr__(self, val):
"""
This method is to get attributes that are not defined in init.
This is when dealing with data and numpy arrays.
"""
if val in ('data', 'shape', 'dtype'):
return getattr(self.__value, val)
# TODO: Probably useful when dealing with DATAIO (Future)
# def __getattr__(self, val):
# """
# This method is to get attributes that are not defined in init.
# This is when dealing with data and numpy arrays.
# """
# if val in ('data', 'shape', 'dtype'):
# return getattr(self.__value, val)

def __getitem__(self, val):
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_term_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def test_validate_error(self):
def test_wrapper_validate_attribute(self):
pass

def test_wrapper_validate_attribute_error(self):
def test_wrapper_validate_dataset(self):
pass

def test_wrapper_append(self):
Expand Down

0 comments on commit 86d5aa8

Please sign in to comment.