Exemple #1
0
 def test_negative_base(self):
     with self.assertRaises(BaseException):
         converter(1, -2)
Exemple #2
0
 def test_2(self):
     self.assertEqual(converter(2, 2), "10")
     self.assertEqual(converter(2, 16), "2")
Exemple #3
0
 def test_1(self):
     self.assertEqual(converter(1, 2), "1")
     self.assertEqual(converter(1, 16), "1")
Exemple #4
0
 def test_1994(self):
     self.assertEqual(converter(1994, 2), "11111001010")
     self.assertEqual(converter(1994, 16), "7CA")
Exemple #5
0
 def test_1024(self):
     self.assertEqual(converter(1024, 2), "10000000000")
     self.assertEqual(converter(1024, 16), "400")
Exemple #6
0
 def test_120(self):
     self.assertEqual(converter(120, 2), "1111000")
     self.assertEqual(converter(120, 16), "78")
Exemple #7
0
 def test_17(self):
     self.assertEqual(converter(17, 2), "10001")
     self.assertEqual(converter(17, 16), "11")
Exemple #8
0
 def test_16(self):
     self.assertEqual(converter(16, 2), "10000")
     self.assertEqual(converter(16, 16), "10")
Exemple #9
0
 def test_10(self):
     self.assertEqual(converter(10, 2), "1010")
     self.assertEqual(converter(10, 16), "A")