Example #1
0
def test_to(conversion_tuples):
    assert Wei(" ".join(conversion_tuples)).to(conversion_tuples[1]) == Fixed(conversion_tuples[0])
Example #2
0
def test_gt():
    assert Wei("2 ether") > "1 ether"
Example #3
0
def test_ge():
    assert Wei("2 ether") >= "1 ether"
    assert Wei("2 ether") >= "2 ether"
Example #4
0
def test_le():
    assert Wei("1 ether") <= "2 ether"
    assert Wei("1 ether") <= "1 ether"
Example #5
0
def test_nonetype():
    assert Wei(None) == 0
Example #6
0
def test_scientific_notation():
    assert Wei(8.32e26) == 832000000000000000000000000
Example #7
0
def test_lt():
    assert Wei("1 ether") < "2 ether"
Example #8
0
def test_type():
    assert type(Wei(12)) is Wei
Example #9
0
def test_eq():
    assert Wei("1 ether") == "1 ether"
Example #10
0
def test_hexstr():
    assert Wei("0xff") == 255
Example #11
0
def test_string_with_unit():
    assert Wei("3.66 ether") == 3660000000000000000
    assert Wei("89.006 gwei") == 89006000000
Example #12
0
def test_str():
    assert Wei("1000") == 1000
Example #13
0
def test_int():
    assert Wei(1000) == 1000
Example #14
0
def test_float():
    assert Wei(1.99) == 1
Example #15
0
def test_raise_to():
    with pytest.raises(TypeError):
        Wei("1 ether").to("foo")
Example #16
0
def test_ne():
    assert Wei("1 ether") != "2 ether"
Example #17
0
 def balance(self) -> Wei:
     """Returns the current ether balance of the contract, in wei."""
     balance = web3.eth.getBalance(self.address)
     return Wei(balance)
Example #18
0
def test_bytes():
    assert Wei(b"\xff") == 255