Skip to content
Snippets Groups Projects
Commit 4ac892c0 authored by Muhamed's avatar Muhamed
Browse files

added wasili tests

parent 0d85a0c3
No related branches found
No related tags found
No related merge requests found
Pipeline #20183 failed
...@@ -5,7 +5,7 @@ from abc import ABC, abstractmethod ...@@ -5,7 +5,7 @@ from abc import ABC, abstractmethod
#from muhamed_directory.other.alma.test2converter import RomanNumber as Alma #from muhamed_directory.other.alma.test2converter import RomanNumber as Alma
#from muhamed_directory.other.daniel.converter import Converter as Dani #from muhamed_directory.other.daniel.converter import Converter as Dani
#from muhamed_directory.other.hatice.converter import RomanNumber as Hati #from muhamed_directory.other.hatice.converter import RomanNumber as Hati
from muhamed_directory.other.wasili.TDD_Converter import RomanNumber as was #from muhamed_directory.other.wasili.TDD_Converter import RomanNumber as was
class IStringCalculator(ABC): class IStringCalculator(ABC):
@abstractmethod @abstractmethod
...@@ -26,9 +26,30 @@ class Converter(IStringCalculator): ...@@ -26,9 +26,30 @@ class Converter(IStringCalculator):
result += roman_numerals[value] result += roman_numerals[value]
n -= value n -= value
return result return result
class TestRomanNumber (unittest.TestCase):
def setUp(self):
self.r = Converter
def test_convert_1(self):
self.assertEqual(self.r.convert(1), "I")
def test_convert_21(self):
self.assertEqual(self.r.convert(21), "XXI")
def test_convert_empty(self):
self.assertEqual(self.r.convert(None), "Fehler: Bitte Zahl eingeben")
def test_convert_string(self):
self.assertEqual(self.r.convert("Hello"), "Fehler: Bitte Zahl eingeben")
def test_convert_downzero(self):
self.assertEqual(self.r.convert(-5), "Integer muss größer als 0 sein")
def test_convert_downzero(self):
self.assertEqual(self.r.convert(1000), "M")
'''class TestRomanConverter(unittest.TestCase):
class TestRomanConverter(unittest.TestCase):
def setUp(self): def setUp(self):
self.calculator = was self.calculator = was
...@@ -52,7 +73,7 @@ class TestRomanConverter(unittest.TestCase): ...@@ -52,7 +73,7 @@ class TestRomanConverter(unittest.TestCase):
self.assertEqual(self.calculator.convert_int_to_str(1000), "M") self.assertEqual(self.calculator.convert_int_to_str(1000), "M")
def test_1999(self): def test_1999(self):
self.assertEqual(self.calculator.convert_int_to_str(1999), "MCMXCIX") self.assertEqual(self.calculator.convert_int_to_str(1999), "MCMXCIX")'''
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()
\ No newline at end of file
...@@ -8,3 +8,4 @@ ...@@ -8,3 +8,4 @@
| ich vs Hatice Tests | no | 1 | FAIL: test_inivalid_numbers (__main__.TestRomanConverter.test_inivalid_numbers) | | ich vs Hatice Tests | no | 1 | FAIL: test_inivalid_numbers (__main__.TestRomanConverter.test_inivalid_numbers) |
| Lasse | yes | all | TypeError: RomanNumerals.to_roman() missing 1 required positional argument: 'num' | | Lasse | yes | all | TypeError: RomanNumerals.to_roman() missing 1 required positional argument: 'num' |
| Wasili | yes | all | TypeError: RomanNumber.convert_int_to_str() missing 1 required positional argument: 'n' | | Wasili | yes | all | TypeError: RomanNumber.convert_int_to_str() missing 1 required positional argument: 'n' |
| ich vs wasili Tests | no | 2 | TypeError: '>=' not supported between instances of 'str' and 'int') |
\ No newline at end of file
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