Skip to content

Commit

Permalink
fix #139 (#141)
Browse files Browse the repository at this point in the history
* fix #139

Exception error is now sorted

* pure flake8
  • Loading branch information
doutriaux1 committed Mar 23, 2017
1 parent a1e053f commit e9f0f2b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 8 additions & 0 deletions tests/test_vcs_show_error_sorted.py
@@ -0,0 +1,8 @@
import unittest
import vcs

class TestVCSShow(unittest.TestCase):
def testSortedErrorAlpha(self):
elts = str(vcs.listelements())
with self.assertRaisesRegexp(Exception,elts):
vcs.show("bad")
10 changes: 5 additions & 5 deletions vcs/utils.py
Expand Up @@ -551,7 +551,7 @@ def listelements(typ=None):
raise Exception(
"Error: '%s' is not a valid vcs element\n"
"Valid vcs elements are: %s" %
(typ, vcs.elements.keys()))
(typ, sorted(vcs.elements.keys())))
return sorted(vcs.elements[typ].keys())


Expand All @@ -569,19 +569,19 @@ def show(*args):
>>> vcs.show() # show all vcs object types
['1d', '3d_dual_scalar', '3d_scalar', '3d_vector', 'boxfill', ...]
>>> vcs.show('boxfill') # List boxfill objects
>>> vcs.show('boxfill') # List boxfill objects
*******************Boxfill Names List**********************
...
*******************End Boxfill Names List**********************
>>> vcs.show('3d_vector') # List 3d_vector objects
>>> vcs.show('3d_vector') # List 3d_vector objects
*******************3d_vector Names List**********************
...
*******************End 3d_vector Names List**********************
>>> vcs.show('3d_scalar') # List 3d_scalar objects
>>> vcs.show('3d_scalar') # List 3d_scalar objects
*******************3d_scalar Names List**********************
...
*******************End 3d_scalar Names List**********************
>>> vcs.show('3d_dual_scalar') # List 3d_dual_scalar objects
>>> vcs.show('3d_dual_scalar') # List 3d_dual_scalar objects
*******************3d_dual_scalar Names List**********************
...
*******************End 3d_dual_scalar Names List**********************
Expand Down

0 comments on commit e9f0f2b

Please sign in to comment.