You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes I parameterize test cases with arguments via argvalues=itertools.product(..., ..., etc.). I'd like to be able to label the parameterized test cases but treat each argument a bit differently based on type. From the parametrize docstring, I was a bit confused whether the intent was to have the callable operate on a single element of an argval tuple, or the entire tuple. Just anecdotally, it seems like the ids customization is operating on one element of the argument value tuple rather than on the entire tuple, prohibiting the position-(type-)dependent behavior that I'd like when using a callable as the argument to ids. I can work around this by putting some type-indicative conditional logic in the callable that I pass to operate on a single tuple element, or just build up a list of string ids instead, but I'd like a cleaner callable route if possible. I'm wondering if I'm making a mistake in how I'm using this feature, or whether this is something that isn't currently supported.
The text was updated successfully, but these errors were encountered:
vreuter
changed the title
Question: Can callable as argument to ids parameter of operate on a tuple?
Question: Can callable as argument to ids parameter of parametrize of operate on a tuple?
Feb 22, 2017
Using
Python 2.7.12
andpytest 3.0.6
Sometimes I parameterize test cases with arguments via
argvalues=itertools.product(..., ..., etc.)
. I'd like to be able to label the parameterized test cases but treat each argument a bit differently based on type. From theparametrize
docstring, I was a bit confused whether the intent was to have the callable operate on a single element of an argval tuple, or the entire tuple. Just anecdotally, it seems like theids
customization is operating on one element of the argument value tuple rather than on the entire tuple, prohibiting the position-(type-)dependent behavior that I'd like when using a callable as the argument toids
. I can work around this by putting some type-indicative conditional logic in the callable that I pass to operate on a single tuple element, or just build up a list of stringids
instead, but I'd like a cleaner callable route if possible. I'm wondering if I'm making a mistake in how I'm using this feature, or whether this is something that isn't currently supported.The text was updated successfully, but these errors were encountered: