@@ -76,20 +76,9 @@ def test_id_memo_invalid_raise(self, id):
76
76
):
77
77
IdMemo (id )
78
78
79
- @pytest .mark .parametrize (
80
- "hex, xdr" ,
81
- [
82
- (
83
- "90d38f2d64949bb64f693ff231f9a3b3" ,
84
- "AAAAA5DTjy1klJu2T2k/8jH5o7MAAAAAAAAAAAAAAAAAAAAA" ,
85
- ),
86
- (
87
- "573c10b148fc4bc7db97540ce49da22930f4bcd48a060dc7347be84ea9f52d9f" ,
88
- "AAAAA1c8ELFI/EvH25dUDOSdoikw9LzUigYNxzR76E6p9S2f" ,
89
- ),
90
- ],
91
- )
92
- def test_hash_memo (self , hex , xdr ):
79
+ def test_hash_memo (self ):
80
+ hex = "573c10b148fc4bc7db97540ce49da22930f4bcd48a060dc7347be84ea9f52d9f"
81
+ xdr = "AAAAA1c8ELFI/EvH25dUDOSdoikw9LzUigYNxzR76E6p9S2f"
93
82
hash = binascii .unhexlify (hex )
94
83
memo = HashMemo (hash )
95
84
assert memo .to_xdr_object ().to_xdr () == xdr
@@ -102,24 +91,21 @@ def test_hash_memo_too_long_raise(self):
102
91
length = 33
103
92
with pytest .raises (
104
93
MemoInvalidException ,
105
- match = "HashMemo can contain 32 bytes at max , got {:d} bytes" .format (length ),
94
+ match = "The length of HashMemo should be 32 bytes, got {:d} bytes. " .format (length ),
106
95
):
107
96
HashMemo (os .urandom (length ))
108
97
109
- @pytest .mark .parametrize (
110
- "hex, xdr" ,
111
- [
112
- (
113
- "90d38f2d64949bb64f693ff231f9a3b3" ,
114
- "AAAABJDTjy1klJu2T2k/8jH5o7MAAAAAAAAAAAAAAAAAAAAA" ,
115
- ),
116
- (
117
- "573c10b148fc4bc7db97540ce49da22930f4bcd48a060dc7347be84ea9f52d9f" ,
118
- "AAAABFc8ELFI/EvH25dUDOSdoikw9LzUigYNxzR76E6p9S2f" ,
119
- ),
120
- ],
121
- )
122
- def test_return_hash_memo (self , hex , xdr ):
98
+ def test_hash_memo_too_short_raise (self ):
99
+ length = 16
100
+ with pytest .raises (
101
+ MemoInvalidException ,
102
+ match = "The length of HashMemo should be 32 bytes, got {:d} bytes." .format (length ),
103
+ ):
104
+ HashMemo (os .urandom (length ))
105
+
106
+ def test_return_hash_memo (self ):
107
+ hex = "573c10b148fc4bc7db97540ce49da22930f4bcd48a060dc7347be84ea9f52d9f"
108
+ xdr = "AAAABFc8ELFI/EvH25dUDOSdoikw9LzUigYNxzR76E6p9S2f"
123
109
return_hash = binascii .unhexlify (hex )
124
110
memo = ReturnHashMemo (return_hash )
125
111
assert memo .to_xdr_object ().to_xdr () == xdr
@@ -129,10 +115,20 @@ def test_return_hash_memo(self, hex, xdr):
129
115
assert base_memo .to_xdr_object ().to_xdr () == xdr
130
116
131
117
def test_return_hash_memo_too_long_raise (self ):
132
- length = 33
118
+ length = 48
119
+ with pytest .raises (
120
+ MemoInvalidException ,
121
+ match = "The length of ReturnHashMemo should be 32 bytes, got {:d} bytes." .format (
122
+ length
123
+ ),
124
+ ):
125
+ ReturnHashMemo (os .urandom (length ))
126
+
127
+ def test_return_hash_memo_too_short_raise (self ):
128
+ length = 16
133
129
with pytest .raises (
134
130
MemoInvalidException ,
135
- match = "ReturnHashMemo can contain 32 bytes at max , got {:d} bytes" .format (
131
+ match = "The length of ReturnHashMemo should be 32 bytes, got {:d} bytes. " .format (
136
132
length
137
133
),
138
134
):
0 commit comments