Skip to content

Commit 0eb1188

Browse files
chore: format black tests/unit/nft_id_test.py with Black. (#1641)
Signed-off-by: AkshayKumarSahu <[email protected]>
1 parent 5841133 commit 0eb1188

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
99

1010

1111
### Tests
12-
12+
- format `black tests/unit/nft_id_test.py` with Black.(#1544)
1313
- Format `tests/unit/executable_test.py` with Black.(#1530)
1414
- Format `tests/unit/hedera_trust_manager_test.py` with Black for consistent code style (#1539)
1515
- Format tests/unit/logger_test.py with black for code style consistency (#1541)

tests/unit/nft_id_test.py

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,54 @@
55
from hiero_sdk_python.hapi.services import basic_types_pb2
66

77
pytestmark = pytest.mark.unit
8+
9+
810
def test_nft_id():
9-
#return true
11+
# return true
1012
nftid_constructor_tokenid = TokenId(shard=0, realm=1, num=2)
11-
nftid_constructor_test = NftId(token_id=nftid_constructor_tokenid, serial_number=1234)
13+
nftid_constructor_test = NftId(
14+
token_id=nftid_constructor_tokenid, serial_number=1234
15+
)
1216

1317
assert str(nftid_constructor_test) == "0.1.2/1234"
14-
assert repr(nftid_constructor_test) == "NftId(token_id=TokenId(shard=0, realm=1, num=2, checksum=None), serial_number=1234)"
18+
assert (
19+
repr(nftid_constructor_test)
20+
== "NftId(token_id=TokenId(shard=0, realm=1, num=2, checksum=None), serial_number=1234)"
21+
)
1522
assert nftid_constructor_test._to_proto().__eq__(
1623
basic_types_pb2.NftID(
1724
token_ID=basic_types_pb2.TokenID(shardNum=0, realmNum=1, tokenNum=2),
18-
serial_number=1234)
25+
serial_number=1234,
26+
)
1927
)
2028
assert NftId._from_proto(
2129
nft_id_proto=basic_types_pb2.NftID(
2230
token_ID=basic_types_pb2.TokenID(shardNum=0, realmNum=1, tokenNum=2),
23-
serial_number=1234
31+
serial_number=1234,
2432
)
2533
).__eq__(nftid_constructor_test)
2634

27-
#return false
35+
# return false
2836
with pytest.raises(TypeError):
2937
nftid_failed_constructor_tokenid1 = TokenId(shard=0, realm=1, num="A")
3038
with pytest.raises(TypeError):
3139
nftid_failed_constructor_tokenid = TokenId(shard=0, realm="b", num=1)
3240
with pytest.raises(TypeError):
33-
nftid_failed_constructor_tokenid = TokenId(shard='c', realm=1, num=1)
41+
nftid_failed_constructor_tokenid = TokenId(shard="c", realm=1, num=1)
3442
with pytest.raises(TypeError):
3543
nftid_failed_constructor = NftId(token_id=None, serial_number=1234)
3644
with pytest.raises(TypeError):
3745
nftid_failed_constructor = NftId(token_id=1234, serial_number=1234)
3846
with pytest.raises(TypeError):
39-
nftid_failed_constructor = NftId(token_id=TokenId(shard=0, realm=1, num=0), serial_number="asdfasdfasdf")
47+
nftid_failed_constructor = NftId(
48+
token_id=TokenId(shard=0, realm=1, num=0), serial_number="asdfasdfasdf"
49+
)
4050
with pytest.raises(ValueError):
41-
nftid_failed_constructor = NftId(token_id=TokenId(shard=0, realm=1, num=0), serial_number=-1234)
51+
nftid_failed_constructor = NftId(
52+
token_id=TokenId(shard=0, realm=1, num=0), serial_number=-1234
53+
)
4254

43-
#don't need to test protobuf cause its final and type checked
55+
# don't need to test protobuf cause its final and type checked
4456
with pytest.raises(ValueError):
4557
NftId.from_string("")
4658

@@ -66,6 +78,7 @@ def test_nft_id():
6678
with pytest.raises(ValueError):
6779
NftId.from_string(fail_str)
6880

81+
6982
def test_get_nft_id_with_checksum(mock_client):
7083
"""Should return string with checksum when ledger id is provided."""
7184
client = mock_client
@@ -74,4 +87,4 @@ def test_get_nft_id_with_checksum(mock_client):
7487
token_id = TokenId.from_string("0.0.1")
7588
nft_id = NftId(token_id, 1)
7689

77-
assert nft_id.to_string_with_checksum(client) == "0.0.1-dfkxr/1"
90+
assert nft_id.to_string_with_checksum(client) == "0.0.1-dfkxr/1"

0 commit comments

Comments
 (0)