def test_calculatrice_addition_chiffres(): assert r.calculatrice('+', "", "") == 0 assert r.calculatrice('+', "I", "") == 1 assert r.calculatrice('+', "I", "I") == 2 assert r.calculatrice('+', "V", "I") == 6 assert r.calculatrice('+', "I", "V") == 6 assert r.calculatrice('+', "V", "X") == 15 assert r.calculatrice('+', "L", "X") == 60 assert r.calculatrice('+', "L", "C") == 150 assert r.calculatrice('+', "D", "C") == 600 assert r.calculatrice('+', "D", "M") == 1500
def test_calculatrice_multiplication_chiffres(): assert r.calculatrice('*', "I", "I") == 1 assert r.calculatrice('*', "V", "I") == 5 assert r.calculatrice('*', "V", "") == 0 assert r.calculatrice('*', "0", "V") == 0 assert r.calculatrice('*', "V", "V") == 25 assert r.calculatrice('*', "V", "X") == 50 assert r.calculatrice('*', "X", "V") == 50
def test_calculatrice_soustraction_nombres(): assert r.calculatrice('-', "IV", "VI") == -2 assert r.calculatrice('-', "VI", "IV") == 2 assert r.calculatrice('-', "IV", "IV") == 0 assert r.calculatrice('-', "XI", "VI") == 5 assert r.calculatrice('-', "MCMXLIV", "XLIV") == 1900 assert r.calculatrice('-', "XL", "MCMXLIV") == -1904
def test_calculatrice_soustraction_chiffres(): assert r.calculatrice('-', "", "") == 0 assert r.calculatrice('-', "I", "") == 1 assert r.calculatrice('-', "", "I") == -1 assert r.calculatrice('-', "I", "I") == 0 assert r.calculatrice('-', "V", "I") == 4 assert r.calculatrice('-', "I", "V") == -4
def test_calculatrice_division_chiffres(): assert r.calculatrice('/', "I", "I") == 1 assert r.calculatrice('/', "V", "I") == 5 assert r.calculatrice('/', "0", "V") == 0 assert r.calculatrice('/', "V", "V") == 1 assert r.calculatrice('/', "V", "X") == 0.5 assert r.calculatrice('/', "X", "V") == 2
def test_calculatrice_addition_nombres(): assert r.calculatrice('+', "IV", "") == 4 assert r.calculatrice('+', "IV", "VI") == 10 assert r.calculatrice('+', "XIV", "LVI") == 70 assert r.calculatrice('+', "III", "MCMXLIV") == 1947
def test_calculatrice_operateur_invalide(): assert r.calculatrice('E', "XL", "V") == 0 assert r.calculatrice('', "XL", "V") == 0
def test_calculatrice_division_par_0(): with pytest.raises(ZeroDivisionError): assert r.calculatrice('/', "X", "")
def test_calculatrice_division_nombres(): assert r.calculatrice('/', "VI", "II") == 3 assert r.calculatrice('/', "IV", "II") == 2 assert r.calculatrice('/', "MCMXLIV", "IV") == 486 assert r.calculatrice('/', "I", "III") == 1 / 3 assert r.calculatrice('/', "XL", "V") == 8
def test_calculatrice_multiplication_nombres(): assert r.calculatrice('*', "IV", "VI") == 24 assert r.calculatrice('*', "VI", "IV") == 24 assert r.calculatrice('*', "VI", "") == 0 assert r.calculatrice('*', "VI", "I") == 6 assert r.calculatrice('*', "MCMXLIV", "X") == 19440