test_easteregg.py 文件源码

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

项目:reahl 作者: reahl 项目源码 文件源码
def test_adding_entry_points_affect_entry_point_map(easter_fixture):
    easter_fixture.stub_egg.add_entry_point_from_line(easter_fixture.group_name,
                      'test1 = reahl.stubble_dev.test_easteregg:TestClass1')

    easter_fixture.stub_egg.add_entry_point(easter_fixture.group_name, 'test2', TestClass2)


    epmap = easter_fixture.stub_egg.get_entry_map()

    assert list(epmap.keys()) == [easter_fixture.group_name]
    name_to_entry_point = list(epmap.values())[0]
    assert len(list(name_to_entry_point.keys())) == 2

    assert isinstance(name_to_entry_point['test1'], pkg_resources.EntryPoint)
    assert name_to_entry_point['test1'].load() is TestClass1
    assert isinstance(name_to_entry_point['test2'], pkg_resources.EntryPoint)
    assert name_to_entry_point['test2'].load() is TestClass2


    easter_fixture.stub_egg.clear()
    assert not easter_fixture.stub_egg.get_entry_map()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号