def test_filter_dir_4(monkeypatch, tmp_path): monkeypatch.setattr('koneko.files.KONEKODIR', tmp_path) (tmp_path / '1234').touch() (tmp_path / 'search').touch() (tmp_path / 'notanumber').touch() assert files.filter_dir(['4']) == ['search']
def test_filter_dir_3(monkeypatch, tmp_path): monkeypatch.setattr('koneko.files.KONEKODIR', tmp_path) (tmp_path / '1234').touch() (tmp_path / 'testuser').touch() (tmp_path / 'following').touch() assert set(files.filter_dir(['3'])) == {'following', 'testuser'}
def test_filter_dir_1(monkeypatch, tmp_path): monkeypatch.setattr('koneko.files.KONEKODIR', tmp_path) (tmp_path / '1234').touch() (tmp_path / 'testgallery').touch() (tmp_path / 'notanumber').touch() assert set(files.filter_dir(['1'])) == {'testgallery', '1234'}
def test_filter_dir_5(monkeypatch, tmp_path): monkeypatch.setattr('koneko.files.KONEKODIR', tmp_path) (tmp_path / '1234').touch() (tmp_path / 'illustfollow').touch() (tmp_path / 'notanumber').touch() assert files.filter_dir(['5']) == ['illustfollow']
def test_filter_dir_2(monkeypatch, tmp_path): monkeypatch.setattr('koneko.files.KONEKODIR', tmp_path) (tmp_path / '1234').mkdir() (tmp_path / '1234' / 'individual').touch() (tmp_path / '5678').mkdir() (tmp_path / 'testgallery').touch() (tmp_path / 'notanumber').touch() assert files.filter_dir(['2']) == ['1234']
def try_filter_dir(modes: 'list[str]') -> 'list[str]': return sorted(files.filter_dir(modes)) or [EMPTY_FILTER_WARNING]