File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111from tck .errors import JsonRpcError
1212from tck .handlers import contract as contract_handlers
1313from tck .param .contract import CreateContractParams
14- from tck .util .param_utils import decode_hex
1514
1615
1716pytestmark = pytest .mark .unit
1817
1918
20- class TestDecodeHex :
21- def test_decodes_plain_hex (self ):
22- assert decode_hex ("60006000" ) == b"\x60 \x00 \x60 \x00 "
23-
24- def test_decodes_0x_prefixed_hex (self ):
25- assert decode_hex ("0x60006000" ) == b"\x60 \x00 \x60 \x00 "
26-
27- def test_rejects_non_hex_characters (self ):
28- with pytest .raises (ValueError ):
29- decode_hex ("0xZZ" )
30-
31- def test_rejects_odd_length (self ):
32- with pytest .raises (ValueError ):
33- decode_hex ("0x123" )
34-
35- def test_rejects_embedded_whitespace (self ):
36- """bytes.fromhex alone would accept "60 00"."""
37- with pytest .raises (ValueError ):
38- decode_hex ("60 00" )
39-
40- def test_rejects_surrounding_whitespace (self ):
41- with pytest .raises (ValueError ):
42- decode_hex (" 6000\n " )
43-
44-
4519class TestCreateContractParams :
4620 def test_parses_all_params (self ):
4721 params = CreateContractParams .parse_json_params (
Original file line number Diff line number Diff line change 1+ """Test cases for the TCK param_utils helpers."""
2+
3+ from __future__ import annotations
4+
5+ import pytest
6+
7+ from tck .util .param_utils import decode_hex
8+
9+
10+ pytestmark = pytest .mark .unit
11+
12+
13+ class TestDecodeHex :
14+ def test_decodes_plain_hex (self ):
15+ assert decode_hex ("60006000" ) == b"\x60 \x00 \x60 \x00 "
16+
17+ def test_decodes_0x_prefixed_hex (self ):
18+ assert decode_hex ("0x60006000" ) == b"\x60 \x00 \x60 \x00 "
19+
20+ def test_rejects_non_hex_characters (self ):
21+ with pytest .raises (ValueError ):
22+ decode_hex ("0xZZ" )
23+
24+ def test_rejects_odd_length (self ):
25+ with pytest .raises (ValueError ):
26+ decode_hex ("0x123" )
27+
28+ def test_rejects_embedded_whitespace (self ):
29+ """bytes.fromhex alone would accept "60 00"."""
30+ with pytest .raises (ValueError ):
31+ decode_hex ("60 00" )
32+
33+ def test_rejects_surrounding_whitespace (self ):
34+ with pytest .raises (ValueError ):
35+ decode_hex (" 6000\n " )
You can’t perform that action at this time.
0 commit comments