Skip to content

Commit

Permalink
fix tests, add test fixtures as submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBuchanan314 committed Feb 21, 2024
1 parent 72cca91 commit 09b4404
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "codec-fixtures"]
path = codec-fixtures
url = https://github.com/ipld/codec-fixtures
1 change: 1 addition & 0 deletions codec-fixtures
Submodule codec-fixtures added at d93d0d
6 changes: 3 additions & 3 deletions test_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ def __repr__(self) -> str:
def __str__(self) -> str:
#print(self.cid_bytes[:5])
# XXX: this is a hack! do proper multiformat logic
if self.cid_bytes.startswith(b'\x00\x01'):
return "b" + base64.b32encode(self.cid_bytes[1:]).decode().lower().rstrip("=")
if self.cid_bytes.startswith(b'\x01'):
return "b" + base64.b32encode(self.cid_bytes).decode().lower().rstrip("=")
else:
return base58.b58encode(self.cid_bytes[1:]).decode()
return base58.b58encode(self.cid_bytes).decode()

# XXX: this is not a good DAG-JSON encoder, it's just here because I need it
# to verify the test results
Expand Down

0 comments on commit 09b4404

Please sign in to comment.