Пример #1
0
 def testCamelToSnakeWorksOnStringsWithUnicodeCharacters(self):
     self.assertEqual("ą_ć_ę", casing.CamelToSnake("ąĆĘ"))
     self.assertEqual("ąąąa_ććća_ęęęa", casing.CamelToSnake("ąąąaĆććaĘęęa"))
     self.assertEqual("ą_ą_ąa_ć_ć_ća_ę_ę_ęa",
                      casing.CamelToSnake("ĄĄĄaĆĆĆaĘĘĘa"))
     self.assertEqual("ą_ą_ą_ć_ć_ć_ę_ę_ę", casing.CamelToSnake("ĄĄĄĆĆĆĘĘĘ"))
     self.assertEqual("ą", casing.CamelToSnake("Ą"))
Пример #2
0
 def testCamelToSnakeWorksOnStringsWithUppercaseLettersOnly(self):
     self.assertEqual("t_h_i_s_i_s_a_s_n_a_k_e",
                      casing.CamelToSnake("THISISASNAKE"))
     self.assertEqual("a_s_n_a_k_e_t_h_i_s_i_s",
                      casing.CamelToSnake("ASNAKETHISIS"))
     self.assertEqual("a_b_c_d", casing.CamelToSnake("ABCD"))
     self.assertEqual("a", casing.CamelToSnake("A"))
Пример #3
0
 def testCamelToSnakeWorksOnStringsWithUnderscores(self):
     self.assertEqual("a_b_c", casing.CamelToSnake("aB_c"))
     self.assertEqual("a_b", casing.CamelToSnake("a_b"))
     self.assertEqual("a_b", casing.CamelToSnake("A_b"))
     self.assertEqual("a_b", casing.CamelToSnake("a_B"))
     self.assertEqual("a_b", casing.CamelToSnake("A_B"))
     self.assertEqual("aa_bb", casing.CamelToSnake("_aaBb_"))
     self.assertEqual("a_bb_c", casing.CamelToSnake("___a_Bb__C___"))
Пример #4
0
 def testCamelToSnakeWorksOnRegularStrings(self):
     self.assertEqual("this_is_a_snake",
                      casing.CamelToSnake("thisIsASnake"))
     self.assertEqual("a_snake_this_is",
                      casing.CamelToSnake("aSnakeThisIs"))
     self.assertEqual("a_b_c_d", casing.CamelToSnake("aBCD"))
Пример #5
0
 def testCamelToSnakeWorksOnOneWordStrings(self):
     self.assertEqual("abcd", casing.CamelToSnake("abcd"))
     self.assertEqual("a", casing.CamelToSnake("a"))
Пример #6
0
 def testCamelToSnakeWorksOnEmptyString(self):
     self.assertEqual("", casing.CamelToSnake(""))