Beispiel #1
0
def test_standard_numeral_conversion(
    decimal_integer: int,
    expected_numeral: str,
) -> None:
    """
    Test conversion from integers to uppercase Unicode Roman numerals
    """
    assert convert_to_numeral(decimal_integer) == expected_numeral
Beispiel #2
0
def test_lowercase_numeral_conversion(
    decimal_integer: int,
    expected_numeral: str,
) -> None:
    """
    Test conversion from integers to lowercase Unicode Roman numerals
    """
    assert (convert_to_numeral(decimal_integer,
                               mode=LOWERCASE) == expected_numeral)
Beispiel #3
0
import roman_numerals

x = int(input())
print(roman_numerals.convert_to_numeral(x))
Beispiel #4
0
def test_invalid_mode_values(invalid_mode_values: Any) -> None:
    """
    Ensure that passing in non-integers results in Type exceptions
    """
    with pytest.raises(ValueError):
        convert_to_numeral(10, mode=invalid_mode_values)
Beispiel #5
0
def test_invalid_types(non_integer_values: Any) -> None:
    """
    Ensure that passing in non-integers results in Type exceptions
    """
    with pytest.raises(TypeError):
        convert_to_numeral(non_integer_values)
Beispiel #6
0
from roman_numerals import convert_to_numeral

print(convert_to_numeral(1234))
def roman(s):
    if s.isnumeric():
        return convert_to_numeral(int(s))
    else:
        return s
Beispiel #8
0
import roman_numerals as rn

print(rn.convert_to_numeral(4000))