python - Dictionary magically converted to set in nosetests -


i have created following nose test:

@nottest def _test_validate_helper_eq(self, input, expected, *args, **kwargs):     result = testedobcject.validateprice(input, *args, **kwargs)     eq_(result, expected)   def test_validate_price(self):     yield self._test_validate_helper_eq, {}, {'price':'0'}     yield self._test_validate_helper_eq, {}, {'price', -1}, 'price', -1` 

validateprice function of tested object:

def validateprice(self, input, name = 'price', default_price=0):   ...   return validated_input 

so i've got test generator produces 2 tests using _test_validate_helper_eq function. _test_validate_helper_eq function takes various number of parameters , passes validateprice

first test pass, there problem second one. can see passing there additional 2 parameters, name , default_price. test fails following error: assertionerror: {'price': u'-1'} != set(['price', -1])

it turns out value of expected parameter set instead of dictionary have defined. don't know if convertion made nose or becaue *args , **kwargs used.

any ideas going on , how fix it?

typo in:

yield self._test_validate_helper_eq, {}, {'price', -1}, 'price', -1` 

here {'price', -1} creates set, want dict , meant type {'price': -1}


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -