File: test_to_string.py

package info (click to toggle)
roman-numerals 4.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 236 kB
  • sloc: python: 393; sh: 6; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 987 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import pytest

from roman_numerals import (
    RomanNumeral,
)

from tests.utils import TEST_NUMERALS_LOWER, TEST_NUMERALS_UPPER


@pytest.mark.parametrize(('n', 'roman_str'), enumerate(TEST_NUMERALS_UPPER, start=1))
def test_str(n: int, roman_str: str) -> None:
    num = RomanNumeral(n)
    assert str(num) == roman_str
    assert f'{num}' == roman_str


@pytest.mark.parametrize(('n', 'roman_str'), enumerate(TEST_NUMERALS_UPPER, start=1))
def test_uppercase(n: int, roman_str: str) -> None:
    num = RomanNumeral(n)
    assert num.to_uppercase() == roman_str


@pytest.mark.parametrize(('n', 'roman_str'), enumerate(TEST_NUMERALS_LOWER, start=1))
def test_lowercase(n: int, roman_str: str) -> None:
    num = RomanNumeral(n)
    assert num.to_lowercase() == roman_str


def test_minitrue() -> None:
    # IGNORANCE IS STRENGTH
    num = RomanNumeral(1984)
    assert f'{num}' == 'MCMLXXXIV'
    assert num.to_uppercase() == 'MCMLXXXIV'
    assert num.to_lowercase() == 'mcmlxxxiv'