From e66473853c0ecd80c233eccb8833d6d19d8ac07b Mon Sep 17 00:00:00 2001 From: ST John Date: Thu, 30 Nov 2017 10:19:29 +0000 Subject: [PATCH] add test --- testing/python/metafunc.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/testing/python/metafunc.py b/testing/python/metafunc.py index 2ffb7bb5d..9ef95dd6b 100644 --- a/testing/python/metafunc.py +++ b/testing/python/metafunc.py @@ -235,6 +235,20 @@ class TestMetafunc(object): for val, expected in values: assert _idval(val, 'a', 6, None) == expected + def test_class_or_function_idval(self): + """unittest for the expected behavior to obtain ids for parametrized + values that are classes or functions: their __name__. + """ + from _pytest.python import _idval + class TestClass: pass + def test_function(): pass + values = [ + (TestClass, "TestClass"), + (test_function, "test_function"), + ] + for val, expected in values: + assert _idval(val, 'a', 6, None) == expected + @pytest.mark.issue250 def test_idmaker_autoname(self): from _pytest.python import idmaker