Example #1
0
    def test_raises(self):
        with self.assertRaises(ValueError):
            Roman(2018)

        with self.assertRaises(ValueError):
            Roman(300) * Roman(10)

        with self.assertRaises(ValueError):
            Roman(2500) - Roman(10)

        with self.assertRaises(ValueError):
            Roman(0)

        with self.assertRaises(ValueError):
            Roman(1) - Roman(1)

        with self.assertRaises(ValueError):
            Roman(-1)
Example #2
0
 def test14(self):
     self.assertFalse(Roman(10) == Roman(20))
Example #3
0
 def test13(self):
     self.assertTrue(Roman(10) + Roman(10) == Roman(20))
Example #4
0
 def test12(self):
     self.assertTrue(Roman(1699) % Roman(10) == Roman(9))
Example #5
0
 def test27(self):
     self.assertEqual(
         str(
             Roman(int(Roman(10)) * int(Roman(100))) -
             Roman(int(Roman(111)) * int(Roman(9)))), 'I')
Example #6
0
 def test24(self):
     self.assertEqual(Roman(1294) % Roman(100) % Roman(10), Roman(4))
Example #7
0
 def test22(self):
     self.assertEqual(Roman(1290) // Roman(100) // Roman(10), Roman(1))
Example #8
0
 def test19(self):
     self.assertEqual(Roman(5) * Roman(5) * Roman(5), Roman(125))
Example #9
0
 def test7(self):
     self.assertEqual(int(Roman(1110)), 1110)
Example #10
0
 def test4(self):
     self.assertEqual(str(Roman(1999)), 'MCMXCIX')
Example #11
0
 def test3(self):
     self.assertEqual(str(Roman(10)), 'X')
Example #12
0
 def test2(self):
     self.assertEqual(str(Roman(8)), 'VIII')
Example #13
0
 def test1(self):
     self.assertEqual(Roman(34) + Roman(1965), Roman(1999))
Example #14
0
 def test28(self):
     self.assertEqual(
         str(
             Roman(int(Roman(1000)) + int(Roman(900))) +
             Roman(int(Roman(90)) + int(Roman(9)))), 'MCMXCIX')
Example #15
0
 def test15(self):
     self.assertEqual(Roman(1000) - Roman(10), Roman(990))
Example #16
0
 def test16(self):
     self.assertEqual(Roman(100) - Roman(10) - Roman(10), Roman(80))
Example #17
0
 def test8(self):
     self.assertEqual(int(Roman(10)), 10)
Example #18
0
 def test20(self):
     self.assertEqual(Roman(100) * Roman(10), Roman(1000))
Example #19
0
 def test10(self):
     self.assertTrue(Roman(1890) - Roman(10) == Roman(1880))
Example #20
0
 def test23(self):
     self.assertEqual(Roman(1290) % Roman(100), Roman(90))
Example #21
0
 def test11(self):
     self.assertTrue(Roman(1699) // Roman(10) == Roman(169))
Example #22
0
 def test25(self):
     self.assertEqual((Roman(2) + Roman(100) - Roman(2)) // Roman(100),
                      Roman(1))
Example #23
0
 def test26(self):
     self.assertEqual(
         Roman(1) * Roman(2) * Roman(9) // Roman(3) - Roman(9) % Roman(5) -
         Roman(9) // Roman(5), Roman(1))