def test_radd_correct(left_part): assert left_part + Dollar(50) == Dollar(100)
def test_add_correct(right_part): assert Dollar(50) + right_part == Dollar(100)
def test_add_incorrect(): with pytest.raises(TypeError): Dollar(50) + "50"
def test_lt_corect_neg(): assert Dollar(-10) < Dollar(-9)
def test_lt_incorrect(): with pytest.raises(AttributeError): Dollar(10) < 20
def test_equal_incorrect(): with pytest.raises(AttributeError): Dollar(100) == 100
def test_lt_correct(): assert Dollar(10) < Dollar(11)
def test_to_incorrect(): with pytest.raises(AttributeError): Dollar(100).to("5")
def test_equal_correct(): assert Dollar(100) == Euro(50)
def test_to_correct(): assert Rubble(100).to(Dollar) == Dollar(2)
def test_create_currency_incorrect_str(): with pytest.raises(TypeError): Dollar("100")
def test_create_currency_correct_int(): d = Dollar(100) assert d.__str__() == "100.0 USD"
def test_radd_incorrect(): with pytest.raises(TypeError): "20" + Dollar(50)
def test_lt_correct(): assert Dollar(10) < Dollar(11) def test_lt_corect_neg(): assert Dollar(-10) < Dollar(-9) def test_lt_incorrect(): with pytest.raises(AttributeError): Dollar(10) < 20 @pytest.mark.parametrize("right_part", [50, Dollar(50), Euro(25)]) def test_add_correct(right_part): assert Dollar(50) + right_part == Dollar(100) def test_add_incorrect(): with pytest.raises(TypeError): Dollar(50) + "50" @pytest.mark.parametrize("left_part", [50, Dollar(50), Euro(25)]) def test_radd_correct(left_part): assert left_part + Dollar(50) == Dollar(100) def test_radd_incorrect():