Пример #1
0
 def test_printable_name_with_code_style(self):
     for inp, exp in [('simple', 'Simple'),
                      ('ALLCAPS', 'ALLCAPS'),
                      ('name with spaces', 'Name With Spaces'),
                      ('    more   spaces    ', 'More Spaces'),
                      ('under_score_name', 'Under Score Name'),
                      ('under__score and spaces', 'Under Score And Spaces'),
                      ('__leading and trailing_ __', 'Leading And Trailing'),
                      ('__12number34__', '12 Number 34'),
                      ('miXed_CAPS_nAMe', 'MiXed CAPS NAMe'),
                      ('with 89_numbers', 'With 89 Numbers'),
                      ('camelCaseName', 'Camel Case Name'),
                      ('mixedCAPSCamelName', 'Mixed CAPS Camel Name'),
                      ('camelCaseWithDigit1', 'Camel Case With Digit 1'),
                      ('teamX', 'Team X'),
                      ('name42WithNumbers666', 'Name 42 With Numbers 666'),
                      ('name42WITHNumbers666', 'Name 42 WITH Numbers 666'),
                      ('12more34numbers', '12 More 34 Numbers'),
                      ('2KW', '2 KW'),
                      ('KW2', 'KW 2'),
                      ('xKW', 'X KW'),
                      ('KWx', 'K Wx'),
                      (':KW', ':KW'),
                      ('KW:', 'KW:'),
                      ('foo-bar', 'Foo-bar'),
                      ('Foo-b:a;r!', 'Foo-b:a;r!'),
                      ('Foo-B:A;R!', 'Foo-B:A;R!'),
                      ('', '')]:
         assert_equal(printable_name(inp, code_style=True), exp)
Пример #2
0
 def test_printable_name_with_code_style(self):
     for inp, exp in [('simple', 'Simple'),
                      ('ALLCAPS', 'ALLCAPS'),
                      ('name with spaces', 'Name With Spaces'),
                      ('    more   spaces    ', 'More Spaces'),
                      ('under_score_name', 'Under Score Name'),
                      ('under__score and spaces', 'Under Score And Spaces'),
                      ('__leading and trailing_ __', 'Leading And Trailing'),
                      ('__12number34__', '12 Number 34'),
                      ('miXed_CAPS_nAMe', 'MiXed CAPS NAMe'),
                      ('with 89_numbers', 'With 89 Numbers'),
                      ('camelCaseName', 'Camel Case Name'),
                      ('mixedCAPSCamelName', 'Mixed CAPS Camel Name'),
                      ('camelCaseWithDigit1', 'Camel Case With Digit 1'),
                      ('teamX', 'Team X'),
                      ('name42WithNumbers666', 'Name 42 With Numbers 666'),
                      ('name42WITHNumbers666', 'Name 42 WITH Numbers 666'),
                      ('12more34numbers', '12 More 34 Numbers'),
                      ('2KW', '2 KW'),
                      ('KW2', 'KW 2'),
                      ('xKW', 'X KW'),
                      ('KWx', 'K Wx'),
                      (':KW', ':KW'),
                      ('KW:', 'KW:'),
                      ('foo-bar', 'Foo-bar'),
                      ('Foo-b:a;r!', 'Foo-b:a;r!'),
                      ('Foo-B:A;R!', 'Foo-B:A;R!'),
                      ('', '')]:
         assert_equal(printable_name(inp, code_style=True), exp)
Пример #3
0
 def test_printable_name(self):
     for inp, exp in [('simple', 'Simple'), ('ALLCAPS', 'ALLCAPS'),
                      ('name with spaces', 'Name With Spaces'),
                      ('more   spaces', 'More Spaces'),
                      ('Cases AND spaces', 'Cases AND Spaces'),
                      ('under_Score_name', 'Under_Score_name'),
                      ('camelCaseName', 'CamelCaseName'),
                      ('with89numbers', 'With89numbers'),
                      ('with 89 numbers', 'With 89 Numbers'), ('', '')]:
         assert_equals(printable_name(inp), exp)
Пример #4
0
 def test_printable_name(self):
     for inp, exp in [('simple', 'Simple'),
                      ('ALLCAPS', 'ALLCAPS'),
                      ('name with spaces', 'Name With Spaces'),
                      ('more   spaces', 'More Spaces'),
                      ('Cases AND spaces', 'Cases AND Spaces'),
                      ('under_Score_name', 'Under_Score_name'),
                      ('camelCaseName', 'CamelCaseName'),
                      ('with89numbers', 'With89numbers'),
                      ('with 89 numbers', 'With 89 Numbers'),
                      ('', '')]:
         assert_equals(printable_name(inp), exp)
Пример #5
0
 def test_printable_name_with_code_style(self):
     for inp, exp in [('simple', 'Simple'), ('ALLCAPS', 'ALLCAPS'),
                      ('under_score_name', 'Under Score Name'),
                      ('under_score and spaces', 'Under Score And Spaces'),
                      ('miXed_CAPS_nAMe', 'MiXed CAPS NAMe'),
                      ('camelCaseName', 'Camel Case Name'),
                      ('camelCaseWithDigit1', 'Camel Case With Digit 1'),
                      ('name42WithNumbers666', 'Name 42 With Numbers 666'),
                      ('12more34numbers', '12 More 34 Numbers'),
                      ('mixedCAPSCamelName', 'Mixed CAPS Camel Name'),
                      ('foo-bar', 'Foo-bar'), ('', '')]:
         assert_equals(printable_name(inp, code_style=True), exp)
Пример #6
0
 def test_printable_name(self):
     for inp, exp in [('simple', 'Simple'), ('ALLCAPS', 'ALLCAPS'),
                      ('name with spaces', 'Name With Spaces'),
                      ('more   spaces', 'More Spaces'),
                      ('  leading and trailing  ', 'Leading And Trailing'),
                      ('  12number34  ', '12number34'),
                      ('Cases AND spaces', 'Cases AND Spaces'),
                      ('under_Score_name', 'Under_Score_name'),
                      ('camelCaseName', 'CamelCaseName'),
                      ('with89numbers', 'With89numbers'),
                      ('with 89 numbers', 'With 89 Numbers'),
                      ('with 89_numbers', 'With 89_numbers'), ('', '')]:
         assert_equal(printable_name(inp), exp)
Пример #7
0
 def test_printable_name_with_code_style(self):
     for inp, exp in [('simple', 'Simple'),
                      ('ALLCAPS', 'ALLCAPS'),
                      ('under_score_name', 'Under Score Name'),
                      ('under_score and spaces', 'Under Score And Spaces'),
                      ('miXed_CAPS_nAMe', 'MiXed CAPS NAMe'),
                      ('camelCaseName', 'Camel Case Name'),
                      ('camelCaseWithDigit1', 'Camel Case With Digit 1'),
                      ('name42WithNumbers666', 'Name 42 With Numbers 666'),
                      ('12more34numbers', '12 More 34 Numbers'),
                      ('mixedCAPSCamelName', 'Mixed CAPS Camel Name'),
                      ('foo-bar', 'Foo-bar'),
                      ('', '')]:
         assert_equals(printable_name(inp, code_style=True), exp)
Пример #8
0
 def test_printable_name(self):
     for inp, exp in [('simple', 'Simple'),
                      ('ALLCAPS', 'ALLCAPS'),
                      ('name with spaces', 'Name With Spaces'),
                      ('more   spaces', 'More Spaces'),
                      ('  leading and trailing  ', 'Leading And Trailing'),
                      ('  12number34  ', '12number34'),
                      ('Cases AND spaces', 'Cases AND Spaces'),
                      ('under_Score_name', 'Under_Score_name'),
                      ('camelCaseName', 'CamelCaseName'),
                      ('with89numbers', 'With89numbers'),
                      ('with 89 numbers', 'With 89 Numbers'),
                      ('with 89_numbers', 'With 89_numbers'),
                      ('', '')]:
         assert_equal(printable_name(inp), exp)
Пример #9
0
 def rename_token(self, token):
     if token is None or (self.ignore and self.ignore in token.value):
         return
     token.value = printable_name(token.value, code_style=True)