예제 #1
0
def test_radd_correct(left_part):
    assert left_part + Dollar(50) == Dollar(100)
예제 #2
0
def test_add_correct(right_part):
    assert Dollar(50) + right_part == Dollar(100)
예제 #3
0
def test_add_incorrect():
    with pytest.raises(TypeError):
        Dollar(50) + "50"
예제 #4
0
def test_lt_corect_neg():
    assert Dollar(-10) < Dollar(-9)
예제 #5
0
def test_lt_incorrect():
    with pytest.raises(AttributeError):
        Dollar(10) < 20
예제 #6
0
def test_equal_incorrect():
    with pytest.raises(AttributeError):
        Dollar(100) == 100
예제 #7
0
def test_lt_correct():
    assert Dollar(10) < Dollar(11)
예제 #8
0
def test_to_incorrect():
    with pytest.raises(AttributeError):
        Dollar(100).to("5")
예제 #9
0
def test_equal_correct():
    assert Dollar(100) == Euro(50)
예제 #10
0
def test_to_correct():
    assert Rubble(100).to(Dollar) == Dollar(2)
예제 #11
0
def test_create_currency_incorrect_str():
    with pytest.raises(TypeError):
        Dollar("100")
예제 #12
0
def test_create_currency_correct_int():
    d = Dollar(100)
    assert d.__str__() == "100.0 USD"
예제 #13
0
def test_radd_incorrect():
    with pytest.raises(TypeError):
        "20" + Dollar(50)
예제 #14
0

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():