Beispiel #1
0
    def visit_ClassDef(self, node):
        if not self.CRE_FORMATS['pascal_case'].match(node.name.value):
            self.add_error('invalid-class-name',
                           node=node.name,
                           args=(node.name.value, 'pascal_case'))

        if camelize(self.source.basename) != node.name.value:
            self.add_error('mismatched-class-name',
                           node=node.name,
                           args=(node.name.value, self.source.filename))
 def test_kebabize_revert(self):
     assert camelize(kebabize('varName')) == 'varName'
 def test_snakeize_revert(self):
     assert camelize(snakeize('specialGuest')) == 'specialGuest'
 def test_pascalcase_and_acronyms(self):
     assert camelize('StringIO', acronyms=['IO']) == 'stringIO'
 def test_camelcase_and_acronyms(self):
     assert camelize('currentThread', acronyms=['THREAD']) == 'currentTHREAD'
 def test_kebabcase_and_acronyms(self):
     assert camelize('long-url-path', acronyms=['URL']) == 'longURLPath'
Beispiel #7
0
 def test_camelize_revert(self):
     assert kebabize(camelize('current-thread')) == 'current-thread'
 def test_snakecase(self):
     assert camelize('var_name') == 'varName'
 def test_dunder_name(self):
     assert camelize('__dunder_name__') == '__dunderName__'
Beispiel #10
0
 def test_protected_name(self):
     assert camelize('_protected_name') == '_protectedName'
Beispiel #11
0
 def test_pascalcase(self):
     assert camelize('StringIO') == 'stringIo'
Beispiel #12
0
 def test_camelcase(self):
     assert camelize('currentThread') == 'currentThread'
Beispiel #13
0
 def test_kebabcase(self):
     assert camelize('long-url-path') == 'longUrlPath'
Beispiel #14
0
 def test_pascalize_revert(self):
     assert camelize(pascalize('stringIo')) == 'stringIo'
Beispiel #15
0
 def test_lowercase_and_acronyms(self):
     assert camelize('stringio', acronyms=['IO']) == 'stringIO'
Beispiel #16
0
 def test_lowercase(self):
     assert camelize('stringio') == 'stringio'
Beispiel #17
0
 def test_snakecase_and_acronyms(self):
     assert camelize('var_name', acronyms=['VA']) == 'VARName'
 def test_camelize_revert(self):
     assert pascalize(camelize('CurrentThread')) == 'CurrentThread'
Beispiel #19
0
 def test_camelize_revert(self):
     assert snakeize(camelize('current_thread')) == 'current_thread'