def test_ddt_data_name_attribute():
"""
Test the ``__name__`` attribute handling of ``data`` items with ``ddt``
"""
def hello():
pass
class Myint(int):
pass
class Mytest(object):
pass
d1 = Myint(1)
d1.__name__ = 'data1'
d2 = Myint(2)
data_hello = data(d1, d2)(hello)
setattr(Mytest, 'test_hello', data_hello)
ddt_mytest = ddt(Mytest)
assert_is_not_none(getattr(ddt_mytest, 'test_hello_1_data1'))
assert_is_not_none(getattr(ddt_mytest, 'test_hello_2_2'))
评论列表
文章目录