test_functional.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:deb-python-ddt 作者: openstack 项目源码 文件源码
def test_file_data_test_names_dict():
    """
    Test that ``file_data`` creates tests with the correct name

    Name is the the function name plus the key in the JSON data,
    when it is parsed as a dictionary.
    """

    tests = set(filter(_is_test, FileDataDummy.__dict__))

    tests_dir = os.path.dirname(__file__)
    test_data_path = os.path.join(tests_dir, 'test_data_dict.json')
    test_data = json.loads(open(test_data_path).read())
    created_tests = set([
        "test_something_again_{0}_{1}".format(index + 1, name)
        for index, name in enumerate(test_data.keys())
    ])

    assert_equal(tests, created_tests)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号