def test_alpha_to_int(self):
     self.assertIs(alpha_to_int(1), None)
     self.assertIs(alpha_to_int('a-3'), None)
     self.assertIs(alpha_to_int(3.14), None)
     self.assertIs(alpha_to_int('aA'), None)
     self.assertEqual(alpha_to_int('a'), 1)
     self.assertEqual(alpha_to_int('Z'), 26)
     self.assertEqual(alpha_to_int('aa'), 27)
     self.assertEqual(alpha_to_int('ZZ'), 52)
Пример #2
0
 def test_alpha_to_int(self):
     self.assertIs(alpha_to_int(1), None)
     self.assertIs(alpha_to_int('a-3'), None)
     self.assertIs(alpha_to_int(3.14), None)
     self.assertIs(alpha_to_int('aA'), None)
     self.assertEqual(alpha_to_int('a'), 1)
     self.assertEqual(alpha_to_int('Z'), 26)
     self.assertEqual(alpha_to_int('aa'), 27)
     self.assertEqual(alpha_to_int('ZZ'), 52)
Пример #3
0
 def alpha_surf_test(self, token, next_token):
     if not alpha_to_int(token):
         return False
     """Determine whether an alpha token is the next logical alpha token"""
     return alpha_to_int(next_token) == alpha_to_int(token) + 1
Пример #4
0
 def alpha_surf_test(self, token, next_token):
     if not alpha_to_int(token):
         return False
     """Determine whether an alpha token is the next logical alpha token"""
     return alpha_to_int(next_token) == alpha_to_int(token) + 1