Skip to content

Commit

Permalink
Add additional parse tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Oct 30, 2024
1 parent f757a23 commit 433302b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@
class TestStruct(unittest.TestCase):
"""Test the data structures."""

def test_default_prefix(self) -> None:
"""Test a default (empty) prefix."""
ref = Reference.from_curie(":something")
self.assertEqual("", ref.prefix)
self.assertEqual("something", ref.identifier)

def test_default_identifier(self) -> None:
"""Test a default (empty) identifier."""
ref = Reference.from_curie("p1:")
self.assertEqual("p1", ref.prefix)
self.assertEqual("", ref.identifier)

def test_multiple_delimiters(self) -> None:
"""Test a default (empty) identifier."""
ref = Reference.from_curie("a1:b2:c3")
self.assertEqual("a1", ref.prefix)
self.assertEqual("b2:c3", ref.identifier)

def test_records(self):
"""Test a list of records."""
records = Records.parse_obj([{"prefix": "chebi", "uri_prefix": CHEBI_URI_PREFIX}])
Expand Down

0 comments on commit 433302b

Please sign in to comment.