mirror of
https://github.com/Xevion/exercism.git
synced 2025-12-11 23:09:55 -06:00
roman numerals exercise
This commit is contained in:
37
python/roman-numerals/roman_numerals_test.py
Normal file
37
python/roman-numerals/roman_numerals_test.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import unittest
|
||||
|
||||
import roman_numerals
|
||||
|
||||
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.2.0
|
||||
|
||||
|
||||
class RomanNumeralsTest(unittest.TestCase):
|
||||
numerals = {
|
||||
1: 'I',
|
||||
2: 'II',
|
||||
3: 'III',
|
||||
4: 'IV',
|
||||
5: 'V',
|
||||
6: 'VI',
|
||||
9: 'IX',
|
||||
27: 'XXVII',
|
||||
48: 'XLVIII',
|
||||
49: 'XLIX',
|
||||
59: 'LIX',
|
||||
93: 'XCIII',
|
||||
141: 'CXLI',
|
||||
163: 'CLXIII',
|
||||
402: 'CDII',
|
||||
575: 'DLXXV',
|
||||
911: 'CMXI',
|
||||
1024: 'MXXIV',
|
||||
3000: 'MMM',
|
||||
}
|
||||
|
||||
def test_numerals(self):
|
||||
for arabic, numeral in self.numerals.items():
|
||||
self.assertEqual(roman_numerals.roman(arabic), numeral)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user