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
评论列表
文章目录