Skip to content

Commit

Permalink
cov
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 committed Oct 23, 2023
1 parent 927eab8 commit 02f8c11
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/hdmf/term_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ def __repr__(self):
re = "Schema Path: %s\n" % self.term_schema_path
re += "Sources: " + ", ".join(list(self.sources.keys()))+"\n"
re += "Terms: \n"
i = 0
i = 1

Check warning on line 65 in src/hdmf/term_set.py

View check run for this annotation

Codecov / codecov/patch

src/hdmf/term_set.py#L62-L65

Added lines #L62 - L65 were not covered by tests
for term in terms:
if i>4:
break

Check warning on line 68 in src/hdmf/term_set.py

View check run for this annotation

Codecov / codecov/patch

src/hdmf/term_set.py#L68

Added line #L68 was not covered by tests
elif i==2:
elif i==3:
re += " ... ... \n"
re += " - %s\n" % term
i += 1
Expand All @@ -79,11 +79,11 @@ def _repr_html_(self):
re = "<b>" + "Schema Path: " + "</b>" + self.term_schema_path + "<br>"
re += "<b>" + "Sources: " + "</b>" + ", ".join(list(self.sources.keys())) + "<br>"
re += "<b> Terms: </b>"
i = 0
i = 1

Check warning on line 82 in src/hdmf/term_set.py

View check run for this annotation

Codecov / codecov/patch

src/hdmf/term_set.py#L79-L82

Added lines #L79 - L82 were not covered by tests
for term in terms:
if i>4:
break

Check warning on line 85 in src/hdmf/term_set.py

View check run for this annotation

Codecov / codecov/patch

src/hdmf/term_set.py#L85

Added line #L85 was not covered by tests
elif i==2:
elif i==3:
re += "... ..."
re += "<li> %s </li>" % term
i += 1
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/example_test_term_set.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ enums:
Myrmecophaga tridactyla:
description: the species is an anteater
meaning: NCBI_TAXON:71006
Panda:
description: the species is panda
meaning: NCBI_TAXON:212257
7 changes: 4 additions & 3 deletions tests/unit/test_term_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,21 @@ def test_repr(self):
termset = TermSet(term_schema_path='tests/unit/example_test_term_set.yaml')
output = ('Schema Path: tests/unit/example_test_term_set.yaml\nSources: NCBI_TAXON\nTerms: \n'+
' - Homo sapiens\n - Mus musculus\n ... ... \n - Ursus arctos horribilis\n'+
' - Myrmecophaga tridactyla\nNumber of terms: 4')
' - Myrmecophaga tridactyla\nNumber of terms: 5')
self.assertEqual(repr(termset), output)

def test_repr_html(self):
termset = TermSet(term_schema_path='tests/unit/example_test_term_set.yaml')
output = ('<b>Schema Path: </b>tests/unit/example_test_term_set.yaml<br><b>Sources:'+
' </b>NCBI_TAXON<br><b> Terms: </b><li> Homo sapiens </li><li> Mus musculus'+
' </li>... ...<li> Ursus arctos horribilis </li><li> Myrmecophaga tridactyla'+
' </li><i> Number of terms:</i> 4')
' </li><i> Number of terms:</i> 5')
self.assertEqual(termset._repr_html_(), output)

def test_view_set(self):
termset = TermSet(term_schema_path='tests/unit/example_test_term_set.yaml')
expected = ['Homo sapiens', 'Mus musculus', 'Ursus arctos horribilis', 'Myrmecophaga tridactyla']
expected = ['Homo sapiens', 'Mus musculus', 'Ursus arctos horribilis', 'Myrmecophaga tridactyla',
'Panda']
self.assertEqual(list(termset.view_set), expected)
self.assertIsInstance(termset.view, SchemaView)

Expand Down

0 comments on commit 02f8c11

Please sign in to comment.