Skip to content

Commit

Permalink
simplified ImportLeaf sorting
Browse files Browse the repository at this point in the history
also fixed a bug in detecting mixed case leafs
  • Loading branch information
Miroslav Shubernetskiy committed Sep 8, 2014
1 parent df51780 commit 1a732a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 1 addition & 4 deletions importanize/statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ def _type(obj):
return 'upper'
elif obj.name.islower():
return 'lower'
elif obj.name[:1].isupper():
return 'mixed'
else:
return 'none'
return 'mixed'

self_type = _type(self)
other_type = _type(other)
Expand All @@ -74,7 +72,6 @@ def _type(obj):
'upper',
'mixed',
'lower',
'none',
)

if self_type != other_type:
Expand Down
4 changes: 4 additions & 0 deletions tests/test_statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ def test_gt(self):
ImportLeaf('aKlassName'),
ImportLeaf('CONSTANT')
)
self.assertGreater(
ImportLeaf('a_variable'),
ImportLeaf('aKlassName')
)

def test_repr(self):
self.assertEqual(
Expand Down

0 comments on commit 1a732a3

Please sign in to comment.