Skip to content

Commit

Permalink
add tests for the streamable macro functions
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-o-how committed Aug 29, 2024
1 parent c602f5c commit 6c2a324
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_spend_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,28 @@ def test_spend_bundle(
class NewAndImprovedSpendBundle(PySpendBundle):
test_bool = True

def new_function(self) -> bool:
return self.test_bool


def test_derive_class():
# Test if aggregate() supports class inheritance
test = PySpendBundle.aggregate([])
assert isinstance(test, PySpendBundle)
test = NewAndImprovedSpendBundle.aggregate([])
assert isinstance(test, NewAndImprovedSpendBundle)
assert test.test_bool
assert test.new_function()

# Test if the Streamable macro functions support class inheritance
obj_bytes = bytes(test)
test = NewAndImprovedSpendBundle.from_bytes(obj_bytes)
assert isinstance(test, NewAndImprovedSpendBundle)
assert test.test_bool
assert test.new_function()

obj_json = test.to_json_dict()
test = NewAndImprovedSpendBundle.from_json_dict(obj_json)
assert isinstance(test, NewAndImprovedSpendBundle)
assert test.test_bool
assert test.new_function()

0 comments on commit 6c2a324

Please sign in to comment.