unpack-iterable and macros #2573
-
I believe that conclusion of ticket #1730 is that Asking for the following problem... maybe there are alternatives? Consider
The following fails because
Or is it better way of implementing this test (without creating additional test functions)? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
I don't get it. If |
Beta Was this translation helpful? Give feedback.
-
I want
And I would like to have parametrized unit test for calls like above. To generalize my example
At the moment (btw. similar technique could be used for hyrule unit tests if i remember well) |
Beta Was this translation helpful? Give feedback.
-
Thanks. |
Beta Was this translation helpful? Give feedback.
That page is for documenting Hy-specific issues. Parametrization via
pytest.mark.parametrize
should work exactly the same in Hy as in Python.Yes, as I understand your example, you're trying to splice the run-time variable
filter
into a macro call. The macro is expanded at compile-time, whenfilter
is just a symbol. If you want to expand at run-time instead, you could sayOr, instead of using
pytest.mark.parametrize
, which resolves at run-time, you could build the four test functions yourself with metaprogramm…