Skip to content

Commit

Permalink
flake
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Jul 28, 2023
1 parent 4020273 commit 43b04b6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ black-check:
poetry run black . --exclude cashu/nostr --check

mypy:
poetry run mypy cashu --ignore-missing
poetry run mypy cashu tests --ignore-missing

flake8:
poetry run flake8 cashu
poetry run flake8 cashu tests

format: isort black

Expand Down
35 changes: 32 additions & 3 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,18 @@ def test_tokenv3_get_proofs():


def test_tokenv3_deserialize_serialize_with_dleq():
token_str = "cashuAeyJ0b2tlbiI6IFt7InByb29mcyI6IFt7ImlkIjogIjI4ajhueVNMMU5kZCIsICJhbW91bnQiOiAyLCAic2VjcmV0IjogInFvS01lMGk1LVgyQy0zc29mVUZUb0EiLCAiQyI6ICIwMmIzYWVlMjAxZDRmYzlhODJkYTJiZTVmOTQzODlmOWIxMzg4YzBkMDA3N2M2ODg1MDhjODIzZmU4OTMwY2YwYzYiLCAiZGxlcSI6IHsiZSI6ICJjMmJkNTMzMTkyZDI2MzExMzM2MjU1OTUxZmQyZTI2OWEwY2E2ODViMzgxMDcwYTFhMzRiMDViYjVlYTBkNTAzIiwgInMiOiAiNzUxOTc5MDczZjk3YjcyMmYzNzJkMzRjZDhlNmY5MWRlYzA0ODE4MTg5NjI3YjYwZWFmYjZjMTY3MjFiZjVmOCIsICJCXyI6ICIwMjVhZjliM2ViNmFkZjgxN2M0YzBjMzhhYWYwZjNhYmJjY2MxODFhY2VmMmNjZTQ4Mzg3MWIwYzEyM2UwOTI1NDgiLCAiQ18iOiAiMDNlMDA2YTRiNGI1ODNlMzI5NTNmYzFmMWI4MmQyZTE1MmQyMjdlYTFhZTgyZTEyOWNiYzc3OWQ5NzYwMTc1Mzg4In19LCB7ImlkIj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"
"lYzA0ODE4MTg5NjI3YjYwZWFmYjZjMTY3MjFiZjVmOCIsICJCXyI6ICIwMjVhZjliM2ViNmFkZjgxN2M0YzBjMzhhYWYwZjNhYmJjY2MxODFhY2VmMmNjZTQ4Mzg3MWIwYzE"
"yM2UwOTI1NDgiLCAiQ18iOiAiMDNlMDA2YTRiNGI1ODNlMzI5NTNmYzFmMWI4MmQyZTE1MmQyMjdlYTFhZTgyZTEyOWNiYzc3OWQ5NzYwMTc1Mzg4In19LCB7ImlkIjogIjI4"
"ajhueVNMMU5kZCIsICJhbW91bnQiOiA4LCAic2VjcmV0IjogIk1TcEdMMG9Qc3cyU2dFOTdvNmh3emciLCAiQyI6ICIwM2EyYjJmMTBjOGI2MjQ0ODRhYmNmYTc3MzUwYjhiN"
"WU1NDAwZWFhYmQxNjA0ZTRjYjliYWQyNjJkZmFhOThmYTgiLCAiZGxlcSI6IHsiZSI6ICJkODI0YzRjNGExNTBmZTQxM2JjM2YzOGNkMGE2NjAxZDU1NWVhYzhjOTNmNDMyOT"
"c0NzQxMGEwOGMzZmYyNTg4IiwgInMiOiAiMjZkZjdhZTk4NzdjN2YyZTE2N2FkZGI4MWRkYjFlNjg1NTE5NmY1NDE3ZDI3MDFiYTdkZmM0NDlkNjYwNTQyZiIsICJCXyI6ICI"
"wMmJlNzQ0NzllOTM0NWU3NWRhNWUzYzliYzcxYjBhMTZlNzZhNDJkMDVjMDA3M2ZjYjgzZmNlYTg3YWJmZGFhYTciLCAiQ18iOiAiMDNkYjA3MjdjYWNjMTQwYTljMzg0YjQx"
"ZjJhMjUyYTg3ODI5YWZhMWU4OWJjZTFlMGY4YWQyMGJkNGQ5Zjc4YjgyIn19XSwgIm1pbnQiOiAiaHR0cDovL2xvY2FsaG9zdDozMzM4In1dfQ=="
)
token = TokenV3.deserialize(token_str)
assert token.serialize(include_dleq=True) == token_str

Expand All @@ -49,8 +60,26 @@ def test_tokenv3_deserialize_serialize():


def test_tokenv3_deserialize_serialize_no_dleq():
token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iI6IFt7InByb29mcyI6IFt7ImlkIjogIjI4ajhueVNMMU5kZCIsICJhbW91bnQiOiAyLCAic2VjcmV0IjogInFvS01lMG"
"k1LVgyQy0zc29mVUZUb0EiLCAiQyI6ICIwMmIzYWVlMjAxZDRmYzlhODJkYTJiZTVmOTQzODlmOWIxMzg4YzBkMDA3N2M2ODg1MDhjODIzZmU"
"4OTMwY2YwYzYifSwgeyJpZCI6ICIyOGo4bnlTTDFOZGQiLCAiYW1vdW50IjogOCwgInNlY3JldCI6ICJNU3BHTDBvUHN3MlNnRTk3bzZod3pn"
"IiwgIkMiOiAiMDNhMmIyZjEwYzhiNjI0NDg0YWJjZmE3NzM1MGI4YjVlNTQwMGVhYWJkMTYwNGU0Y2I5YmFkMjYyZGZhYTk4ZmE4In1dLCAib"
"WludCI6ICJodHRwOi8vbG9jYWxob3N0OjMzMzgifV19"
)
token = TokenV3.deserialize(token_str)
assert token.serialize(include_dleq=False) == token_str_no_dleq

Expand Down

0 comments on commit 43b04b6

Please sign in to comment.