Skip to content

Commit

Permalink
Example of encoding reference ARI's
Browse files Browse the repository at this point in the history
  • Loading branch information
justinethier committed Nov 13, 2024
1 parent d14563c commit f299907
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions tests/test_ari_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,25 +465,28 @@ def test_ari_text_encode_lit_prim_tstr(self):
#
# #TODO: add function code
#
# def test_ari_text_encode_nsref_text(self):
# TEST_CASE = [
# ("adm", "ari://adm/"),
# ("example-adm-a@2024-06-25", "ari://example-adm-a@2024-06-25/"),
# ("example-adm-a", "ari://example-adm-a/"),
# ("!example-odm-b", "ari://!example-odm-b/"),
# ("65536", "ari://65536/"),
# ("-20", "ari://-20/"),
# ]
# for row in TEST_CASE:
# value, expect = row
# with self.subTest(value):
# enc = ari_text.Encoder()
# ari = LiteralARI(value)
# loop = io.StringIO()
# enc.encode(ari, loop)
# LOGGER.info('Got text_dn: %s', loop.getvalue())
# self.assertEqual(expect, loop.getvalue())
#
def test_ari_text_encode_nsref_text(self):
TEST_CASE = [
("adm", "ari://adm/"),
("example-adm-a@2024-06-25", "ari://example-adm-a@2024-06-25/"),
("example-adm-a", "ari://example-adm-a/"),
("!example-odm-b", "ari://!example-odm-b/"),
("65536", "ari://65536/"),
("-20", "ari://-20/"),
]
for row in TEST_CASE:
value, expect = row
with self.subTest(value):
enc = ari_text.Encoder()
ari = ReferenceARI(
ident=Identity(value, None, None),
params=None
)
loop = io.StringIO()
enc.encode(ari, loop)
LOGGER.info('Got text_dn: %s', loop.getvalue())
self.assertEqual(expect, loop.getvalue())

# def test_ari_text_encode_nsref_int(self):
# TEST_CASE = [
# (18, "ari://18/"),
Expand Down

0 comments on commit f299907

Please sign in to comment.