Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Tests were passing a list but the function expects a tuple
  • Loading branch information
facundofc committed May 2, 2019
1 parent 4842519 commit 9b4a94d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion doit/task.py
Expand Up @@ -407,7 +407,7 @@ def check_attr(task, attr, value, valid):
@param valid (list): of valid types/value accepted
@raises InvalidTask if invalid input
"""
if isinstance(value, tuple(valid[0])):
if isinstance(value, valid[0]):
return
if value in valid[1]:
return
Expand Down
10 changes: 5 additions & 5 deletions tests/test_task.py
Expand Up @@ -51,21 +51,21 @@ def test_task_verbosity_not_specified(self):
class TestTaskCheckInput(object):

def testOkType(self):
task.Task.check_attr('xxx', 'attr', [], ([int, list],[]))
task.Task.check_attr('xxx', 'attr', [], ((int, list),()))

def testOkTypeABC(self):
task.Task.check_attr('xxx', 'attr', {}, ([Iterable],[]))
task.Task.check_attr('xxx', 'attr', {}, ((Iterable,),()))

def testOkValue(self):
task.Task.check_attr('xxx', 'attr', None, ([list], [None]))
task.Task.check_attr('xxx', 'attr', None, ((list,), (None,)))

def testFailType(self):
pytest.raises(task.InvalidTask, task.Task.check_attr, 'xxx',
'attr', int, ([list], [False]))
'attr', int, ((list,), (False,)))

def testFailValue(self):
pytest.raises(task.InvalidTask, task.Task.check_attr, 'xxx',
'attr', True, ([list], [False]))
'attr', True, ((list,), (False,)))



Expand Down

0 comments on commit 9b4a94d

Please sign in to comment.