test_scanner_unit.py 文件源码

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

项目:dirtools3 作者: kirpit 项目源码 文件源码
def test_internal_find_index_called_for_each_item(self, monkeypatch, tmp_folder):
        """Internal finding an index number whilst scanning only called within
        _insert_sorted() method during async scanning. So it should be called
        only per item. Testing for: def _find_index(self, summary, sort_by).

        :param monkeypatch: pytest monkey patch fixture
        :type monkeypatch: _pytest.monkeypatch.MonkeyPatch
        :param tmp_folder: Test params and dummy test folder factory fixture pair.
        :type tmp_folder: (dict, dirtools.tests.factory.DummyFolderFactory)
        """
        params, factory = tmp_folder
        scan = Folder(factory.path, params['sort_by'], params['level'])
        find_index = Mock(return_value=0)
        monkeypatch.setattr(scan, '_find_index', find_index)

        for item in scan.items(humanise=False):
            assert call(item, params['sort_by']) in find_index.call_args_list
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号