Skip to content
Snippets Groups Projects
Commit 9b1b3c6d authored by Alma Berisha's avatar Alma Berisha
Browse files

Tests für Muhamed (Momo) hinzugefügt

parent cef51c67
No related branches found
No related tags found
No related merge requests found
import unittest
import importlib.util
def load_student_convert(path):
spec = importlib.util.spec_from_file_location("student_module", path)
student_module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(student_module)
return student_module.convert
class TestAliciImplementation(unittest.TestCase):
def setUp(self):
self.convert = load_student_convert("other/AliciMuhamed/RomanNumber.py")
def test_values(self):
self.assertEqual(self.convert(3), "III")
self.assertEqual(self.convert(6), "VI")
self.assertEqual(self.convert(8), "VIII")
self.assertEqual(self.convert(12), "XII")
self.assertEqual(self.convert(17), "XVII")
self.assertEqual(self.convert(29), "XXIX")
self.assertEqual(self.convert(34), "XXXIV")
self.assertEqual(self.convert(55), "LV")
self.assertEqual(self.convert(101), "CI")
self.assertEqual(self.convert(501), "DI")
self.assertEqual(self.convert(1003), "MIII")
if __name__ == "__main__":
unittest.main()
import unittest
from my_romannumber import RomanNumber
def convert(n: int) -> str:
return RomanNumber().convert(n)
class TestRomanConverter(unittest.TestCase):
def test_1(self):
self.assertEqual(convert(1), "I")
def test_10(self):
self.assertEqual(convert(10), "X")
def test_21(self):
self.assertEqual(convert(21), "XXI")
def test_50(self):
self.assertEqual(convert(50), "L")
def test_100(self):
self.assertEqual(convert(100), "C")
def test_1000(self):
self.assertEqual(convert(1000), "M")
def test_1999(self):
self.assertEqual(convert(1999), "MCMXCIX")
if __name__ == "__main__":
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment