def test_base_conversion_zero_high_low(self): self.assertEqual(base_conversion(0, 9, 4), 0)
def test_base_conversion_high_low(self): self.assertEqual(base_conversion(1234, 9, 2), 1110011010)
def test_base_conversion_zero_same(self): self.assertEqual(base_conversion(0, 10, 10), 0)
def test_base_conversion_same_base(self): self.assertEqual(base_conversion(80, 10, 10), 80)
def test_base_conversion_low_high(self): self.assertEqual(base_conversion(67, 10, 2), 1000011)
def test_base_conversion_negative(self): self.assertEqual(-25, q09.base_conversion(2, -10101, 8))
def test_base_conversion_error(self, mock_stdout): expected = "The number entered is cannot be converted!\n" base_conversion(27, 4, 10) self.assertEqual(mock_stdout.getvalue(), expected)
def test_base_conversion_destination_base_higher_than_10(self): with self.assertRaises(ValueError): base_conversion(5, 1256, 23)
def test_base_conversion_destination_base_return_type(self): self.assertIsInstance(base_conversion(2, 10010, 6), int)
def test_base_conversion_original_base_higher_than_10(self): with self.assertRaises(ValueError): base_conversion(53, 1256, 6)
def test_base_conversion_destination_base_lower_than_2(self): with self.assertRaises(ValueError): base_conversion(5, 1256, 1)
def test_base_conversion_original_base_lower_than_2(self): with self.assertRaises(ValueError): base_conversion(-2, 1256, 6)
def test_base_conversion_positive(self): self.assertEqual(25, q09.base_conversion(2, 10101, 8))
def test_base_conversion_return_type(self): self.assertEqual(int, type(q09.base_conversion(2, 10101, 8)))
def test_base_conversion_zero_low_high(self): self.assertEqual(base_conversion(0, 3, 8), 0)
def test_base_conversion_positive_original_number(self): self.assertEqual(base_conversion(4, 1322, 2), 1111010)
def test_base_conversion_type(self): self.assertIsInstance(base_conversion(2, 10, 8), int)
def test_base_conversion_zero(self): self.assertEqual(0, q09.base_conversion(2, 0, 10))