Exemple #1
0
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']
Exemple #2
0
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'}
Exemple #3
0
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'}
Exemple #4
0
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']
Exemple #5
0
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']
Exemple #6
0
def try_filter_dir(modes: 'list[str]') -> 'list[str]':
    return sorted(files.filter_dir(modes)) or [EMPTY_FILTER_WARNING]