Skip to content

Commit 68489a2

Browse files
authored
chore(tools): add support for large ints in Wei class (#2265)
* Add support for large ints in `Wei` class Signed-off-by: Luis Mastrangelo <[email protected]> * Avoid using lambda Signed-off-by: Luis Mastrangelo <[email protected]> --------- Signed-off-by: Luis Mastrangelo <[email protected]>
1 parent ef11a98 commit 68489a2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/ethereum_test_base_types/base_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def __new__(cls, input_number: NumberConvertible | Self):
8383
base, exp = value_str.split("**")
8484
value = float(base) ** int(exp)
8585
else:
86-
value = float(value_str)
86+
value = int(value_str) if value_str.isdecimal() else float(value_str)
8787
return super(Number, cls).__new__(cls, value * multiplier)
8888
return super(Number, cls).__new__(cls, to_number(input_number))
8989

src/ethereum_test_base_types/tests/test_base_types.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ def test_address_padding():
163163
("1e18", 10**18),
164164
("1 ether", 10**18),
165165
("2 ether", 2 * 10**18),
166+
("70000 ether", 70000 * 10**18),
167+
("123456 ether", 123456 * 10**18),
168+
("123456.789 ether", 123456.789 * 10**18),
166169
("2.1 ether", 2.1 * 10**18),
167170
("2.1 Ether", 2.1 * 10**18),
168171
("2.1 ETHER", 2.1 * 10**18),

0 commit comments

Comments
 (0)