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