Skip to content

Commit 789b077

Browse files
committed
Add support for ByteString type and fix constructor id for test
1 parent bf37e94 commit 789b077

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

pycardano/plutus.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ def id_map(cls, skip_constructor=False):
454454
Constructs a unique representation of a PlutusData type definition.
455455
Intended for automatic constructor generation.
456456
"""
457-
if cls == bytes:
457+
if cls == bytes or cls == ByteString:
458458
return "bytes"
459459
if cls == int:
460460
return "int"

test/pycardano/test_plutus.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -431,16 +431,15 @@ class B(PlutusData):
431431
def test_plutus_data_long_bytes():
432432
@dataclass
433433
class A(PlutusData):
434+
CONSTR_ID = 0
434435
a: ByteString
435436

436437
quote = (
437438
"The line separating good and evil passes ... right through every human heart."
438439
)
439440

440441
quote_hex = (
441-
"d866821a8e5890cf9f5f5840546865206c696e652073657061726174696e6720676f6f6420616"
442-
"e64206576696c20706173736573202e2e2e207269676874207468726f7567682065766572794d"
443-
"2068756d616e2068656172742effff"
442+
"d8799f5f5840546865206c696e652073657061726174696e6720676f6f6420616e64206576696c20706173736573202e2e2e207269676874207468726f7567682065766572794d2068756d616e2068656172742effff"
444443
)
445444

446445
A_tmp = A(ByteString(quote.encode()))

0 commit comments

Comments
 (0)