Exemple #1
0
 def test_is_narcissistic(self):
     self.assertFalse(is_narcissistic("10"))
     self.assertTrue(is_narcissistic("223", 4))
     self.assertTrue(is_narcissistic("115132219018763992565095597973971522401"))
     self.assertTrue(is_narcissistic("C64E7", 16))
     self.assertFalse(is_narcissistic("c64e6", 16))
Exemple #2
0
 def test_with_numbers_in_base_ten(self):
     self.assertTrue(solution.is_narcissistic('32164049651'))
     self.assertFalse(solution.is_narcissistic('6325629'))
Exemple #3
0
 def test_default_base_is_ten(self):
     self.assertTrue(solution.is_narcissistic('153'))
Exemple #4
0
 def test_with_numbers_in_higher_bases_with_digits_greater_than_9(self):
     self.assertTrue(solution.is_narcissistic('A', 11))
     self.assertTrue(solution.is_narcissistic('C60E7', 16))
Exemple #5
0
 def test_with_with_numbers_in_higher_bases_with_digits_less_than_9(self):
     self.assertFalse(solution.is_narcissistic('765', 15))
     self.assertTrue(solution.is_narcissistic('192', 23))
     self.assertFalse(solution.is_narcissistic('9632', 36))
Exemple #6
0
 def test_with_numbers_in_lower_bases(self):
     self.assertTrue(solution.is_narcissistic('1', 2))
     self.assertFalse(solution.is_narcissistic('11', 5))
     self.assertTrue(solution.is_narcissistic('13', 7))