id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11,700 | cmd_result.py | andreafrancia_trash-cli/tests/support/run/cmd_result.py | from tests.support.help.help_reformatting import reformat_help_message
from tests.support.text.last_line_of import last_line_of
class CmdResult:
def __init__(self,
stdout, # type: str
stderr, # type: str
exit_code, # type: int
): # (...) -> N... | 1,089 | Python | .py | 28 | 30.428571 | 71 | 0.60076 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,701 | run_command.py | andreafrancia_trash-cli/tests/support/run/run_command.py | import os
import subprocess
import sys
from tests.support.dicts import merge_dicts
from tests.support.make_scripts import script_path_for
from tests.support.project_root import project_root
from tests.support.run.cmd_result import CmdResult
def run_command(cwd, command, args=None, input='', env=None):
if env is ... | 1,016 | Python | .py | 24 | 31.125 | 74 | 0.600202 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,702 | last_line_of.py | andreafrancia_trash-cli/tests/support/text/last_line_of.py | def last_line_of(stdout):
if len(stdout.splitlines()) > 0:
return stdout.splitlines()[-1]
else:
return ''
| 130 | Python | .py | 5 | 20.2 | 38 | 0.592 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,703 | grep.py | andreafrancia_trash-cli/tests/support/text/grep.py | def grep(stream, pattern): # type: (str, str) -> str
return ''.join([line
for line in stream.splitlines(True)
if pattern in line])
| 176 | Python | .py | 4 | 32 | 55 | 0.52907 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,704 | list_trash_dir.py | andreafrancia_trash-cli/tests/support/trash_dirs/list_trash_dir.py | from tests.support.dirs.list_file_in_subdir import list_files_in_subdir
def list_trash_dir(trash_dir_path):
return (list_files_in_subdir(trash_dir_path, 'info') +
list_files_in_subdir(trash_dir_path, 'files'))
| 228 | Python | .py | 4 | 51.5 | 71 | 0.716216 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,705 | __init__.py | andreafrancia_trash-cli/tests/support/asserts/__init__.py | import unittest
def assert_equals_with_unidiff(expected, actual):
def unidiff(expected, actual):
import difflib
expected = expected.splitlines(1)
actual = actual.splitlines(1)
diff = difflib.unified_diff(expected, actual,
fromfile='Expected', to... | 847 | Python | .py | 20 | 28.55 | 73 | 0.527473 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,706 | restore_fake_fs.py | andreafrancia_trash-cli/tests/test_restore/support/restore_fake_fs.py | import os
from typing import Iterable
from trashcli.restore.file_system import FileReader
from trashcli.restore.file_system import ListingFileSystem
class RestoreFakeFs(FileReader, ListingFileSystem):
def __init__(self,
fs, # type FakeFs
):
self.fs = fs
def conten... | 561 | Python | .py | 15 | 29.733333 | 70 | 0.651852 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,707 | fake_logger.py | andreafrancia_trash-cli/tests/test_restore/support/fake_logger.py | from __future__ import print_function
from trashcli.restore.trashed_files import RestoreLogger
class FakeLogger(RestoreLogger):
def __init__(self, out):
self.out = out
def warning(self, message):
print("WARN: %s" % message, file=self.out)
| 266 | Python | .py | 7 | 33.142857 | 56 | 0.703125 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,708 | test_restore2.py | andreafrancia_trash-cli/tests/test_restore/cmd/test_restore2.py | import datetime
import unittest
from tests.support.py2mock import Mock, call
from tests.support.restore.fake_restore_fs import FakeRestoreFs
from tests.support.restore.restore_user import RestoreUser
from trashcli.restore.file_system import RestoreWriteFileSystem
class TestRestore2(unittest.TestCase):
def setUp... | 3,020 | Python | .py | 58 | 41.051724 | 83 | 0.598436 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,709 | test_restore_with_real_fs.py | andreafrancia_trash-cli/tests/test_restore/cmd/test_restore_with_real_fs.py | import os
import unittest
import pytest
from tests.support.asserts.assert_that import assert_that
from tests.support.dirs.my_path import MyPath
from tests.support.restore.a_trashed_file import ATrashedFile
from tests.support.restore.has_been_restored_matcher import \
has_been_restored
from tests.support.restore.r... | 4,661 | Python | .py | 87 | 42.068966 | 80 | 0.622056 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,710 | test_end_to_end_restore.py | andreafrancia_trash-cli/tests/test_restore/cmd/test_end_to_end_restore.py | import os
import unittest
from datetime import datetime
from os.path import exists as file_exists
from os.path import join as pj
import pytest
from tests.support.fakes.fake_trash_dir import FakeTrashDir
from tests.support.dirs.my_path import MyPath
from tests.support.run.run_command import run_command
from trashcli.f... | 3,702 | Python | .py | 71 | 42.619718 | 91 | 0.610127 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,711 | test_listing_in_restore_cmd.py | andreafrancia_trash-cli/tests/test_restore/cmd/test_listing_in_restore_cmd.py | import unittest
from tests.support.py2mock import Mock
from six import StringIO
from trashcli.restore.file_system import FakeReadCwd
from trashcli.restore.handler import Handler
from trashcli.restore.restore_cmd import RestoreCmd
from trashcli.restore.trashed_file import TrashedFile
from trashcli.restore.trashed_file... | 2,611 | Python | .py | 57 | 35.052632 | 74 | 0.625394 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,712 | test_trashed_file_restore_integration.py | andreafrancia_trash-cli/tests/test_restore/cmd/test_trashed_file_restore_integration.py | import os
import unittest
from tests.support.py2mock import Mock
from six import StringIO
from tests.support.files import make_empty_file
from tests.support.dirs.my_path import MyPath
from trashcli.lib.my_input import HardCodedInput
from trashcli.restore.file_system import RealRestoreWriteFileSystem, \
FakeReadCw... | 2,574 | Python | .py | 52 | 36.807692 | 88 | 0.606531 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,713 | test_restore.py | andreafrancia_trash-cli/tests/test_restore/cmd/test_restore.py | import datetime
from tests.support.asserts.assert_that import assert_that
from tests.support.restore.fake_restore_fs import FakeRestoreFs
from tests.support.restore.has_been_restored_matcher import \
has_been_restored, has_not_been_restored
from tests.support.restore.restore_user import RestoreUser
class TestSea... | 4,114 | Python | .py | 73 | 41.452055 | 87 | 0.539935 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,714 | test_restore_arg_parser.py | andreafrancia_trash-cli/tests/test_restore/components/arg_parser/test_restore_arg_parser.py | import unittest
from trashcli.lib.print_version import PrintVersionArgs
from trashcli.restore.args import RunRestoreArgs, Sort
from trashcli.restore.restore_arg_parser import RestoreArgParser
class TestRestoreArgs(unittest.TestCase):
def setUp(self):
self.parser = RestoreArgParser()
def test_default... | 1,647 | Python | .py | 32 | 32.21875 | 73 | 0.511845 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,715 | test_sequences.py | andreafrancia_trash-cli/tests/test_restore/components/collaborators/test_sequences.py | import unittest
from trashcli.restore.restore_asking_the_user import parse_indexes
class TestSequences(unittest.TestCase):
def test(self):
sequences = parse_indexes("1-5,7", 10)
result = [index for index in sequences.all_indexes()]
self.assertEqual([1, 2, 3, 4, 5, 7], result)
| 308 | Python | .py | 7 | 38.571429 | 66 | 0.701342 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,716 | test_all_trash_directories.py | andreafrancia_trash-cli/tests/test_restore/components/collaborators/test_all_trash_directories.py | import unittest
from trashcli.fstab.volumes import FakeVolumes2
from trashcli.restore.trash_directories import TrashDirectories1
class TestTrashDirectories(unittest.TestCase):
def setUp(self):
environ = {'HOME': '~'}
self.volumes = FakeVolumes2("volume_of(%s)", [])
self.trash_directories ... | 838 | Python | .py | 18 | 35.666667 | 80 | 0.570025 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,717 | test_trash_directories2.py | andreafrancia_trash-cli/tests/test_restore/components/collaborators/test_trash_directories2.py | import unittest
import pytest
from tests.support.py2mock import Mock, call
from tests.support.fakes.stub_volume_of import StubVolumeOf
from trashcli.restore.trash_directories import TrashDirectories2
@pytest.mark.slow
class TestTrashDirectories2(unittest.TestCase):
def setUp(self):
self.trash_directorie... | 1,346 | Python | .py | 29 | 37.551724 | 74 | 0.683244 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,718 | test_is_trashed_from_path.py | andreafrancia_trash-cli/tests/test_restore/components/collaborators/test_is_trashed_from_path.py | import unittest
from trashcli.restore.run_restore_action import original_location_matches_path
class TestOriginalLocationMatchesPath(unittest.TestCase):
def test1(self):
assert original_location_matches_path("/full/path", "/full") == True
def test2(self):
assert original_location_matches_pat... | 565 | Python | .py | 11 | 45.454545 | 86 | 0.711679 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,719 | test_restore_asking_the_user.py | andreafrancia_trash-cli/tests/test_restore/components/collaborators/test_restore_asking_the_user.py | import unittest
from tests.support.py2mock import Mock, call
from trashcli.lib.my_input import HardCodedInput
from trashcli.restore.output_event import Quit
from trashcli.restore.output_recorder import OutputRecorder
from trashcli.restore.restore_asking_the_user import RestoreAskingTheUser
from trashcli.restore.resto... | 1,644 | Python | .py | 32 | 37.71875 | 77 | 0.611111 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,720 | test_parse_indexes.py | andreafrancia_trash-cli/tests/test_restore/components/collaborators/test_parse_indexes.py | import unittest
import six
from trashcli.restore.range import Range
from trashcli.restore.restore_asking_the_user import InvalidEntry, parse_indexes
from trashcli.restore.sequences import Sequences
from trashcli.restore.single import Single
class TestParseIndexes(unittest.TestCase):
def test_non_numeric(self):
... | 1,580 | Python | .py | 34 | 36.382353 | 82 | 0.614733 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,721 | test_trash_directory.py | andreafrancia_trash-cli/tests/test_restore/components/collaborators/test_trash_directory.py | import unittest
import pytest
import six
from tests.support.files import make_file, require_empty_dir
from tests.support.dirs.my_path import MyPath
from trashcli.restore.file_system import RealListingFileSystem
from trashcli.restore.info_files import InfoFiles
@pytest.mark.slow
class TestTrashDirectory(unittest.Tes... | 1,943 | Python | .py | 38 | 40.289474 | 93 | 0.632275 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,722 | test_trashed_files.py | andreafrancia_trash-cli/tests/test_restore/components/trashed_files/test_trashed_files.py | import datetime
import unittest
from six import StringIO
from tests.support.put.fake_fs.fake_fs import FakeFs
from tests.test_restore.support.fake_logger import FakeLogger
from tests.test_restore.support.restore_fake_fs import RestoreFakeFs
from trashcli.restore.info_dir_searcher import InfoDirSearcher
from trashcli.... | 3,700 | Python | .py | 77 | 31.662338 | 74 | 0.521775 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,723 | test_trashed_files_integration.py | andreafrancia_trash-cli/tests/test_restore/components/trashed_files/test_trashed_files_integration.py | import datetime
import unittest
from tests.support.py2mock import Mock
from tests.support.files import make_file, require_empty_dir
from tests.support.dirs.remove_dir_if_exists import remove_dir_if_exists
from trashcli.fs import remove_file
from trashcli.restore.file_system import RealFileReader
from trashcli.restore... | 1,600 | Python | .py | 33 | 39.30303 | 73 | 0.672867 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,724 | test_mock_dir_reader.py | andreafrancia_trash-cli/tests/test_support/test_mock_dir_reader.py | import unittest
from tests.support.fakes.mock_dir_reader import MockDirReader
class TestMockDirReader(unittest.TestCase):
def setUp(self):
self.fs = MockDirReader()
def test_empty(self):
result = self.fs.entries_if_dir_exists('/')
self.assertEqual([], result)
def test_add_file_i... | 907 | Python | .py | 23 | 32.043478 | 61 | 0.624857 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,725 | test_fake_file_system.py | andreafrancia_trash-cli/tests/test_support/test_fake_file_system.py | # Copyright (C) 2011-2021 Andrea Francia Bereguardo(PV) Italy
import unittest
from tests.support.fakes.fake_file_system import FakeFileSystem
class TestFakeFileSystem(unittest.TestCase):
def setUp(self):
self.fs = FakeFileSystem()
def test_you_can_read_from_files(self):
self.fs.create_fake_f... | 1,377 | Python | .py | 26 | 45.576923 | 75 | 0.654735 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,726 | test_fake_fstab.py | andreafrancia_trash-cli/tests/test_support/test_fake_fstab.py | import unittest
from tests.support.fakes.fake_volume_of import FakeVolumeOf
class TestFakeFstab(unittest.TestCase):
def test_default(self):
volumes = FakeVolumeOf()
assert ["/"] == only_mount_points(volumes, ["/"])
def test_it_should_accept_fake_mount_points(self):
volumes = FakeVolu... | 696 | Python | .py | 16 | 37.0625 | 75 | 0.649331 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,727 | test_filesystem.py | andreafrancia_trash-cli/tests/test_support/test_filesystem.py | # Copyright (C) 2008-2021 Andrea Francia Bereguardo(PV) Italy
import os
import unittest
import pytest
from trashcli.fs import has_sticky_bit, mkdirs, is_sticky_dir
from tests.support.files import make_empty_file, set_sticky_bit, unset_sticky_bit
from tests.support.dirs.my_path import MyPath
@pytest.mark.slow
class... | 1,795 | Python | .py | 41 | 37.146341 | 81 | 0.671288 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,728 | test_partitions.py | andreafrancia_trash-cli/tests/test_support/test_partitions.py | import unittest
from trashcli.fstab.mount_points_listing import Partitions
class MockPartition:
def __init__(self, device=None, mountpoint=None, fstype=None):
self.device = device
self.mountpoint = mountpoint
self.fstype = fstype
class TestOsMountPoints(unittest.TestCase):
def setUp... | 958 | Python | .py | 25 | 29.52 | 66 | 0.642082 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,729 | test_tox_version_matches.py | andreafrancia_trash-cli/tests/test_support/test_tox_version_matches.py | import os
import sys
def test_tox_version_matched():
env_name = os.getenv('TOX_ENV_NAME', None)
version = sys.version_info
assert (env_name, version.major, version.minor) in [
('py27', 2, 7),
('py310', 3, 10),
(None, version.major, version.minor)
] | 291 | Python | .py | 10 | 23.9 | 56 | 0.616487 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,730 | test_fake_volume_of.py | andreafrancia_trash-cli/tests/test_support/test_fake_volume_of.py | import pytest
from tests.support.fakes.fake_volume_of import FakeVolumeOf
class TestFakeVolumeOf:
@pytest.fixture
def volumes(self):
return FakeVolumeOf()
def test_return_the_containing_volume(self, volumes):
volumes.add_volume('/fake-vol')
assert '/fake-vol' == volumes.volume_o... | 697 | Python | .py | 16 | 36.5 | 67 | 0.677083 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,731 | test_joining_paths.py | andreafrancia_trash-cli/tests/test_support/test_joining_paths.py | # Copyright (C) 2011 Andrea Francia Trivolzio(PV) Italy
def test_how_path_joining_works():
from os.path import join
assert '/another-absolute' == join('/absolute', '/another-absolute')
assert '/absolute/relative' == join('/absolute', 'relative')
assert '/absolute' == join('relative', '/absolute')
a... | 426 | Python | .py | 8 | 49.125 | 72 | 0.673861 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,732 | test_fake_ismount.py | andreafrancia_trash-cli/tests/test_support/test_fake_ismount.py | import unittest
from tests.support.fakes.fake_is_mount import FakeIsMount
class TestOnDefault(unittest.TestCase):
def setUp(self):
self.ismount = FakeIsMount([])
def test_by_default_root_is_mount(self):
assert self.ismount.is_mount('/')
def test_while_by_default_any_other_is_not_a_moun... | 1,261 | Python | .py | 28 | 38.642857 | 67 | 0.699341 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,733 | test_has_been_restored.py | andreafrancia_trash-cli/tests/test_support/test_has_been_restored.py | import unittest
from tests.support.put.fake_fs.fake_fs import FakeFs
from tests.support.restore.a_trashed_file import a_trashed_file
from tests.support.restore.has_been_restored_matcher import \
has_been_restored
class TestHasBeenRestored(unittest.TestCase):
def setUp(self):
self.fs = FakeFs()
... | 4,240 | Python | .py | 75 | 42.133333 | 94 | 0.57559 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,734 | test_make_unreadable_file.py | andreafrancia_trash-cli/tests/test_support/files/test_make_unreadable_file.py | import unittest
import pytest
from trashcli.fs import read_file
from ...support.files import make_unreadable_file
from tests.support.dirs.my_path import MyPath
@pytest.mark.slow
class Test_make_unreadable_file(unittest.TestCase):
def setUp(self):
self.tmp_dir = MyPath.make_temp_dir()
def test(self... | 550 | Python | .py | 16 | 29 | 57 | 0.704545 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,735 | test_make_unreadable_dir.py | andreafrancia_trash-cli/tests/test_support/files/test_make_unreadable_dir.py | import errno
import os
import shutil
import unittest
from trashcli.fs import remove_file2
from ...support.files import make_unreadable_dir, \
make_readable
from tests.support.dirs.my_path import MyPath
class Test_make_unreadable_dir(unittest.TestCase):
def setUp(self):
self.tmp_dir = MyPath.make_tem... | 907 | Python | .py | 25 | 29.84 | 64 | 0.694508 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,736 | test_split_paragraphs.py | andreafrancia_trash-cli/tests/test_support/test_help_reformatting/test_split_paragraphs.py | from parameterized import parameterized # type: ignore
from tests.support.help.help_reformatting import split_paragraphs
@parameterized.expand([
('one line', ['one line']),
('one line\n', ['one line\n']),
('one\ntwo\n', ['one\ntwo\n']),
('one\n\ntwo\n', ['one\n', 'two\n']),
('one\n \ntwo\n', ... | 447 | Python | .py | 11 | 37.181818 | 65 | 0.648961 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,737 | test_parse_help.py | andreafrancia_trash-cli/tests/test_support/test_help_reformatting/test_parse_help.py | from tests.support.help.help_reformatting import reformat_help_message, split_paragraphs
class TestParseHelp:
def test_format_help_message(self):
assert reformat_help_message(self.help_message) == (
'usage: trash-list [-h] [--print-completion {bash,zsh,tcsh}] [--version] '
'[--volu... | 3,272 | Python | .py | 65 | 40.276923 | 88 | 0.531289 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,738 | test_normalize_spaces.py | andreafrancia_trash-cli/tests/test_support/test_help_reformatting/test_normalize_spaces.py | from tests.support.help.help_reformatting import normalize_spaces
class TestNormalizeSpaces:
def test(self):
text = """usage: trash-list [-h] [--print-completion {bash,zsh,tcsh}] [--version]
[--volumes] [--trash-dirs] [--trash-dir TRASH_DIRS]
[--all-users]"""
a... | 537 | Python | .py | 10 | 43.2 | 89 | 0.570611 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,739 | test_trash_list.py | andreafrancia_trash-cli/tests/test_list/cmd/test_trash_list.py | # Copyright (C) 2011-2024 Andrea Francia Trivolzio(PV) Italy
from tests.test_list.cmd.support.trash_list_user import trash_list_user
user = trash_list_user
class TestTrashList:
def test_should_output_nothing_when_trashcan_is_empty(self, user):
output = user.run_trash_list()
assert output.whole_... | 2,830 | Python | .py | 50 | 44.68 | 80 | 0.592229 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,740 | test_list_uses_volume_trash_dirs.py | andreafrancia_trash-cli/tests/test_list/cmd/test_list_uses_volume_trash_dirs.py | # Copyright (C) 2011 Andrea Francia Trivolzio(PV) Italy
import pytest
from tests.test_list.cmd.support.trash_list_user import trash_list_user # noqa
class TestListUsesVolumeTrashDirs:
@pytest.fixture
def user(self, trash_list_user):
u = trash_list_user
u.set_fake_uid(123)
u.add_disk(... | 902 | Python | .py | 19 | 40.526316 | 79 | 0.669336 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,741 | test_end_to_end_list.py | andreafrancia_trash-cli/tests/test_list/cmd/test_end_to_end_list.py | import datetime
import unittest
import pytest
from tests.support.fakes.fake_trash_dir import FakeTrashDir
from tests.support.help.help_reformatting import reformat_help_message
from tests.support.dirs.my_path import MyPath
from tests.support.run.run_command import run_command
@pytest.mark.slow
class TestEndToEndLis... | 2,980 | Python | .py | 58 | 39.758621 | 78 | 0.574036 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,742 | test_with_a_top_trash_dir.py | andreafrancia_trash-cli/tests/test_list/cmd/test_with_a_top_trash_dir.py | # Copyright (C) 2011-2024 Andrea Francia Trivolzio(PV) Italy
import pytest
from tests.test_list.cmd.support.trash_list_user import trash_list_user # noqa
class TestWithATopTrashDir:
@pytest.fixture
def user(self, trash_list_user):
u = trash_list_user
u.set_fake_uid(123)
u.add_disk("t... | 1,981 | Python | .py | 40 | 41.075 | 89 | 0.649506 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,743 | test_list_volumes.py | andreafrancia_trash-cli/tests/test_list/cmd/test_list_volumes.py | from tests.test_list.cmd.support.trash_list_user import trash_list_user # noqa
user = trash_list_user
class TestListVolumes:
def test(self, user):
user.add_disk("/disk1")
user.add_disk("/disk2")
user.add_disk("/disk3")
output = user.run_trash_list('--volumes')
assert o... | 461 | Python | .py | 11 | 28.909091 | 79 | 0.524775 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,744 | test_adjust_for_root.py | andreafrancia_trash-cli/tests/test_list/cmd/test_adjust_for_root.py | from tests.test_list.cmd.support.trash_list_user import adjust_for_root
class TestAdjustForRoot:
def test(self):
assert adjust_for_root("disk") == "disk"
assert adjust_for_root("/disk") == "disk"
assert adjust_for_root("//disk") == "disk"
| 269 | Python | .py | 6 | 38.833333 | 71 | 0.662835 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,745 | test_version.py | andreafrancia_trash-cli/tests/test_list/cmd/test_version.py | # Copyright (C) 2011-2024 Andrea Francia Trivolzio(PV) Italy
from tests.test_list.cmd.support.trash_list_user import trash_list_user
user = trash_list_user
class TestVersion:
def test_should_output_the_version(self, user):
user.set_version('1.2.3')
output = user.run_trash_list('--version')
... | 378 | Python | .py | 8 | 42 | 71 | 0.708791 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,746 | trash_list_user.py | andreafrancia_trash-cli/tests/test_list/cmd/support/trash_list_user.py | import os
import pytest
from six import StringIO
from tests.support.dirs.my_path import MyPath
from tests.support.fakes.fake_trash_dir import FakeTrashDir
from tests.support.fakes.stub_volume_of import StubVolumeOf
from tests.support.files import make_empty_dir
from trashcli.empty.main import FileSystemContentReader
... | 2,795 | Python | .py | 70 | 32.885714 | 80 | 0.673809 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,747 | run_result.py | andreafrancia_trash-cli/tests/test_list/cmd/support/run_result.py | from typing import NamedTuple
from tests.support.text.sort_lines import sort_lines
class RunResult(NamedTuple("RunResult", [
('stdout', str),
('stderr', str),
])):
def whole_output(self):
return self.stderr + self.stdout
def sorted_whole_output(self):
return sort_lines(self.whole_out... | 474 | Python | .py | 14 | 28.428571 | 52 | 0.682819 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,748 | test_trash_list_parser.py | andreafrancia_trash-cli/tests/test_list/components/test_trash_list_parser.py | import unittest
import trashcli.list
import trashcli.list.main
import trashcli.list.parser
from trashcli.lib.print_version import PrintVersionArgs
class TestTrashListParser(unittest.TestCase):
def setUp(self):
self.parser = trashcli.list.parser.Parser("trash-list")
def test_version(self):
ar... | 1,180 | Python | .py | 31 | 31.193548 | 63 | 0.648099 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,749 | test_trash_dirs_selector.py | andreafrancia_trash-cli/tests/test_list/components/test_trash_dirs_selector.py | import unittest
from tests.support.fakes.stub_volume_of import StubVolumeOf
from trashcli.list.trash_dir_selector import TrashDirsSelector
from trashcli.trash_dirs_scanner import trash_dir_found
class MockScanner:
def __init__(self, name):
self.name = name
def scan_trash_dirs(self, environ, uid):
... | 1,344 | Python | .py | 27 | 36.518519 | 79 | 0.575479 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,750 | test_deletion_date_extractor.py | andreafrancia_trash-cli/tests/test_list/components/test_deletion_date_extractor.py | import datetime
import unittest
from trashcli.list.extractors import DeletionDateExtractor
class TestDeletionDateExtractor(unittest.TestCase):
def setUp(self):
self.extractor = DeletionDateExtractor()
def test_extract_attribute_default(self):
result = self.extractor.extract_attribute(None, "... | 587 | Python | .py | 12 | 43.166667 | 91 | 0.715789 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,751 | test_file_size.py | andreafrancia_trash-cli/tests/test_list/components/test_file_size.py | from tests.support.dirs.temp_dir import temp_dir # noqa
from tests.support.files import make_file
from trashcli import fs
class TestFileSize:
def test(self, temp_dir):
make_file(temp_dir / 'a-file', '123')
result = fs.file_size(temp_dir / 'a-file')
assert 3 == result
| 300 | Python | .py | 8 | 32.625 | 56 | 0.685121 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,752 | test_move.py | andreafrancia_trash-cli/tests/test_fs/test_move.py | import unittest
from tests.support.files import make_file
from tests.support.dirs.my_path import MyPath
from trashcli.fs import move, read_file
class TestMove(unittest.TestCase):
def setUp(self):
self.tmp_dir = MyPath.make_temp_dir()
def test_two_files(self):
make_file(self.tmp_dir / 'a', "A... | 763 | Python | .py | 20 | 31.4 | 52 | 0.618852 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,753 | test_list_of_created_scripts.py | andreafrancia_trash-cli/tests/test_dev_tools/test_make_scripts/test_list_of_created_scripts.py | from tests.support.py2mock import Mock
from tests.support.make_scripts import Scripts
from tests.support.make_scripts import script_path_without_base_dir_for
class TestListOfCreatedScripts:
def setup_method(self):
self.bindir = Scripts(make_file_executable=Mock(), write_file=Mock())
def test_is_empt... | 609 | Python | .py | 12 | 44.666667 | 77 | 0.721284 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,754 | test_make_script.py | andreafrancia_trash-cli/tests/test_dev_tools/test_make_scripts/test_make_script.py | from textwrap import dedent
from tests.support import py2mock as mock
from tests.support.py2mock import Mock
from tests.support.make_scripts import Scripts
from tests.support.make_scripts import script_path_for
class TestMakeScript:
def setup_method(self):
self.make_file_executable = Mock()
self... | 1,582 | Python | .py | 35 | 33.885714 | 83 | 0.60052 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,755 | test_generate_scripts.py | andreafrancia_trash-cli/tests/test_dev_tools/test_make_scripts/test_generate_scripts.py | import pytest
from tests.support.make_scripts import make_scripts
@pytest.mark.slow
class TestGenerateScripts:
def test(self):
scripts = make_scripts()
scripts.add_script('trash', 'trashcli.put.main', 'main')
scripts.add_script('trash-put', 'trashcli.put.main', 'main')
scripts.ad... | 929 | Python | .py | 18 | 34.611111 | 76 | 0.516556 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,756 | fake_cal.py | andreafrancia_trash-cli/tests/test_dev_tools/support/fake_cal.py | from tests.support.tools.core.cal import Cal
from tests.support.trashinfo.parse_date import parse_date
class FakeCal(Cal):
def __init__(self, today):
self._today = parse_date(today)
def today(self):
return self._today
| 246 | Python | .py | 7 | 30.142857 | 57 | 0.710638 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,757 | fake_system.py | andreafrancia_trash-cli/tests/test_dev_tools/support/fake_system.py | class FakeSystem:
def __init__(self):
self.clean = False
self.os_system_calls = []
def set_dirty(self):
self.clean = False
def set_clean(self):
self.clean = True
def os_system(self, cmd):
self.os_system_calls.append(cmd)
if cmd == 'git diff-index --quie... | 365 | Python | .py | 12 | 22.833333 | 63 | 0.58 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,758 | run_set_dev_version.py | andreafrancia_trash-cli/tests/test_dev_tools/support/run_set_dev_version.py | from io import StringIO
from typing import NamedTuple
from typing import Optional
from tests.support.capture_exit_code import capture_exit_code
from tests.support.put.fake_fs.fake_fs import FakeFs
from tests.support.tools.set_dev_version import SetDevVersionCmd
from tests.test_dev_tools.cmds.test_bump_cmd import FakeC... | 1,430 | Python | .py | 38 | 29.473684 | 78 | 0.588406 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,759 | test_set_dev_version_cmd.py | andreafrancia_trash-cli/tests/test_dev_tools/cmds/test_set_dev_version_cmd.py | from tests.support.put.fake_fs.fake_fs import FakeFs
from tests.test_dev_tools.support.run_set_dev_version import RunSetDevVersion
def adjust_py27(output):
return output.replace("prg: error: too few arguments\n",
'prg: error: the following arguments '
'are requi... | 1,922 | Python | .py | 44 | 32.954545 | 80 | 0.557342 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,760 | test_bump_cmd.py | andreafrancia_trash-cli/tests/test_dev_tools/cmds/test_bump_cmd.py | from tests.support.capture_exit_code import capture_exit_code
from tests.support.put.fake_fs.fake_fs import FakeFs
from tests.support.tools.bump_cmd import BumpCmd
from tests.test_dev_tools.support.fake_cal import FakeCal
from tests.test_dev_tools.support.fake_system import FakeSystem
class TestBumpCmd:
def setup... | 1,985 | Python | .py | 42 | 38.428571 | 77 | 0.605794 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,761 | test_save_new_version.py | andreafrancia_trash-cli/tests/test_dev_tools/components/test_save_new_version.py | from tests.support.dirs.my_path import MyPath
from tests.support.files import make_file
from tests.support.tools.version_saver import VersionSaver
from trashcli.fs import read_file
from trashcli.put.fs.real_fs import RealFs
class TestSaveNewVersion:
def setup_method(self):
self.tmp_dir = MyPath.make_temp_... | 1,219 | Python | .py | 39 | 27.153846 | 75 | 0.677199 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,762 | test_version_from_date.py | andreafrancia_trash-cli/tests/test_dev_tools/components/test_version_from_date.py | import datetime
from tests.support.tools.version_from_date import version_from_date
class TestVersionFromDate:
def test(self):
today = datetime.date(2021, 5, 11)
result = version_from_date(today)
assert result == '0.21.5.11'
| 259 | Python | .py | 7 | 31.142857 | 67 | 0.707317 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,763 | recording_backend.py | andreafrancia_trash-cli/tests/test_put/support/recording_backend.py | from typing import IO
from typing import List
from tests.test_put.support.logs import Logs
from tests.test_put.support.log_line import LogLine
from trashcli.put.core.logs import LogData
from trashcli.put.core.logs import LogEntry
from trashcli.put.my_logger import LoggerBackend
from trashcli.put.my_logger import Stre... | 1,133 | Python | .py | 27 | 29.185185 | 69 | 0.576364 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,764 | result.py | andreafrancia_trash-cli/tests/test_put/support/result.py | from typing import List
from typing import Tuple
from tests.test_put.support.logs import Logs
from trashcli.put.core.logs import LogTag
class Result:
def __init__(self,
stderr, # type: List[str]
err, # type: str
exit_code, # type: int
collect... | 836 | Python | .py | 23 | 25.086957 | 69 | 0.533416 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,765 | log_line.py | andreafrancia_trash-cli/tests/test_put/support/log_line.py | from typing import NamedTuple
from trashcli.put.core.logs import Level
from trashcli.put.core.logs import LogTag
class LogLine(NamedTuple('LogLine', [
('level', Level),
('verbose', int),
('program_name', str),
('message', str),
('tag', LogTag)
])):
pass
| 281 | Python | .py | 11 | 22.090909 | 41 | 0.677903 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,766 | logs.py | andreafrancia_trash-cli/tests/test_put/support/logs.py | from typing import List
from typing import NamedTuple
from tests.test_put.support.log_line import LogLine
from trashcli.put.core.logs import LogTag
from trashcli.put.my_logger import is_right_for_level
class Logs(NamedTuple('Logs', [
('logs', List[LogLine])
])):
def as_stderr_lines(self):
return ["%s... | 712 | Python | .py | 19 | 28.684211 | 64 | 0.58952 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,767 | test_put.py | andreafrancia_trash-cli/tests/test_put/cmd/test_put.py | import os
from typing import List
from typing import Optional
import flexmock
from six import StringIO
from tests.support.fakes.fake_is_mount import FakeIsMount
from tests.support.put.dummy_clock import FixedClock
from tests.support.put.dummy_clock import jan_1st_2024
from tests.support.put.fake_fs.failing_fake_fs im... | 14,433 | Python | .py | 268 | 40.955224 | 204 | 0.56156 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,768 | test_put_script.py | andreafrancia_trash-cli/tests/test_put/cmd/test_put_script.py | import unittest
import pytest
from tests.support.run.run_command import run_command
@pytest.mark.slow
class TestRmScript(unittest.TestCase):
def test_trash_put_works(self):
result = run_command('.', 'trash-put')
assert ("usage: trash-put [OPTION]... FILE..." in
result.stderr.spli... | 549 | Python | .py | 13 | 35.307692 | 74 | 0.655367 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,769 | test_on_dot_arguments.py | andreafrancia_trash-cli/tests/test_put/cmd/e2e/test_on_dot_arguments.py | import pytest
from tests.support.dirs.temp_dir import temp_dir
from tests.support.files import mkdir_p
from tests.test_put.cmd.e2e.run_trash_put import run_trash_put
from trashcli.lib.exit_codes import EX_IOERR
temp_dir = temp_dir
@pytest.mark.slow
class TestWhenFedWithDotArguments:
def test_dot_argument_is_sk... | 1,925 | Python | .py | 38 | 42.763158 | 75 | 0.648158 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,770 | test_on_links_to_dirs.py | andreafrancia_trash-cli/tests/test_put/cmd/e2e/test_on_links_to_dirs.py | import pytest
from tests.support.dirs.temp_dir import temp_dir
from tests.test_put.cmd.e2e.run_trash_put.directory_layout import \
DirectoriesLayout
from trashcli.put.fs.real_fs import RealFs
temp_dir = temp_dir
@pytest.mark.slow
class TestOnLinksToDirs:
def test_link_to_dir_without_slashes(self, temp_dir):... | 1,741 | Python | .py | 38 | 33.631579 | 80 | 0.544864 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,771 | test_on_symbolic_links.py | andreafrancia_trash-cli/tests/test_put/cmd/e2e/test_on_symbolic_links.py | import os
import pytest
from tests.support.dirs.temp_dir import temp_dir
from tests.support.files import make_file
from tests.support.dirs.my_path import MyPath
from tests.test_put.cmd.e2e.run_trash_put import run_trash_put
from trashcli.put.fs.real_fs import RealFs
fs = RealFs()
temp_dir = temp_dir
def _make_conn... | 1,475 | Python | .py | 31 | 40.548387 | 83 | 0.6471 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,772 | test_on_non_existent_file.py | andreafrancia_trash-cli/tests/test_put/cmd/e2e/test_on_non_existent_file.py | import pytest
from tests.test_put.cmd.e2e.run_trash_put import run_trash_put
from tests.test_put.cmd.e2e.test_end_to_end_put import temp_dir
from trashcli.lib.exit_codes import EX_IOERR
temp_dir = temp_dir
@pytest.mark.slow
class TestOnNonExistentFile:
def test_fails(self, temp_dir):
result = run_trash_p... | 490 | Python | .py | 12 | 35.166667 | 73 | 0.694737 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,773 | test_on_trashing_a_file.py | andreafrancia_trash-cli/tests/test_put/cmd/e2e/test_on_trashing_a_file.py | import pytest
from tests.support.files import make_empty_file
from tests.test_put.cmd.e2e.run_trash_put import run_trash_put2
from tests.support.dirs.temp_dir import temp_dir
temp_dir = temp_dir
@pytest.mark.slow
class TestOnTrashingAFile:
def test_in_verbose_mode_should_tell_where_a_file_is_trashed(self,
... | 766 | Python | .py | 17 | 34.941176 | 75 | 0.591644 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,774 | test_on_existing_file.py | andreafrancia_trash-cli/tests/test_put/cmd/e2e/test_on_existing_file.py | # Copyright (C) 2009-2020 Andrea Francia Trivolzio(PV) Italy
import pytest
from tests.support.dirs.temp_dir import temp_dir
from tests.support.files import make_empty_file
from tests.test_put.cmd.e2e.run_trash_put import run_trash_put2
temp_dir = temp_dir
@pytest.mark.slow
class TestOnExistingFile:
def test_it... | 1,189 | Python | .py | 27 | 34.037037 | 78 | 0.60451 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,775 | test_end_to_end_put.py | andreafrancia_trash-cli/tests/test_put/cmd/e2e/test_end_to_end_put.py | # Copyright (C) 2021 Andrea Francia Bereguardo(PV) Italy
from textwrap import dedent
import pytest
from tests.support.dirs.my_path import MyPath
from tests.support.dirs.temp_dir import temp_dir
from tests.test_put.cmd.e2e.run_trash_put import run_trash_put
from trashcli.lib.exit_codes import EX_IOERR
temp_dir = temp... | 3,897 | Python | .py | 75 | 38.84 | 82 | 0.549842 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,776 | test_unsecure_trash_dir_messages.py | andreafrancia_trash-cli/tests/test_put/cmd/e2e/test_unsecure_trash_dir_messages.py | # Copyright (C) 2009-2020 Andrea Francia Trivolzio(PV) Italy
import os
import pytest
from tests.support.files import make_empty_file
from tests.support.files import make_sticky_dir
from tests.support.files import require_empty_dir
from tests.test_put.cmd.e2e.run_trash_put import run_trashput_with_vol
from tests.suppo... | 2,244 | Python | .py | 44 | 43.295455 | 90 | 0.643478 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,777 | put_result.py | andreafrancia_trash-cli/tests/test_put/cmd/e2e/run_trash_put/put_result.py | from typing import NamedTuple
from tests.support.run.cmd_result import CmdResult
from tests.support.help.help_reformatting import reformat_help_message
from tests.support.dirs.my_path import MyPath
from tests.test_put.cmd.e2e.run_trash_put.stream import Stream
class PutResult(NamedTuple('Output', [
('stderr', St... | 1,291 | Python | .py | 30 | 33.766667 | 76 | 0.621212 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,778 | stream.py | andreafrancia_trash-cli/tests/test_put/cmd/e2e/run_trash_put/stream.py | from typing import NamedTuple
from tests.support.text.grep import grep
from tests.support.dirs.my_path import MyPath
class Stream(NamedTuple('Output', [
('stream', str),
('temp_dir', MyPath)
])):
def lines(self):
return self.stream.replace(self.temp_dir, '').splitlines()
def last_line(self):... | 925 | Python | .py | 26 | 27.769231 | 66 | 0.614607 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,779 | directory_layout.py | andreafrancia_trash-cli/tests/test_put/cmd/e2e/run_trash_put/directory_layout.py | from tests.test_put.cmd.e2e.run_trash_put import PutResult
from tests.test_put.cmd.e2e.run_trash_put import run_trash_put4
class Result:
def __init__(self,
layout, # type: DirectoriesLayout
output, # type: PutResult
):
self.output = output
self.... | 1,589 | Python | .py | 40 | 29.55 | 84 | 0.56864 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,780 | __init__.py | andreafrancia_trash-cli/tests/test_put/cmd/e2e/run_trash_put/__init__.py | from typing import List
from typing import Optional
from tests.support.run.run_command import run_command
from tests.support.dirs.my_path import MyPath
from tests.test_put.cmd.e2e.run_trash_put.put_result import PutResult
from tests.test_put.cmd.e2e.run_trash_put.put_result import make_put_result
from tests.test_put.c... | 2,654 | Python | .py | 61 | 31.278689 | 75 | 0.52 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,781 | test_describer_integration.py | andreafrancia_trash-cli/tests/test_put/components/test_describer_integration.py | # Copyright (C) 2011-2022 Andrea Francia Bereguardo(PV) Italy
import os
import unittest
import pytest
from tests.support.files import make_empty_file, make_file, require_empty_dir
from tests.support.dirs.my_path import MyPath
from trashcli.put.describer import Describer
from trashcli.put.fs.real_fs import RealFs
@p... | 2,118 | Python | .py | 41 | 44.926829 | 88 | 0.672983 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,782 | test_move_file.py | andreafrancia_trash-cli/tests/test_put/components/test_move_file.py | import pytest
from tests.support.dirs.my_path import MyPath
from trashcli.put.fs.real_fs import RealFs
from trashcli.put.janitor_tools.put_trash_dir import move_file
from tests.support.dirs.temp_dir import temp_dir
temp_dir = temp_dir
class TestMoveFile:
@pytest.mark.slow
def test_delete_when_traling_slash(... | 668 | Python | .py | 15 | 37.333333 | 78 | 0.655332 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,783 | test_user.py | andreafrancia_trash-cli/tests/test_put/components/test_user.py | import unittest
from typing import cast
import flexmock
from trashcli.lib.my_input import HardCodedInput
from trashcli.put.describer import Describer
from trashcli.put.user import (
User,
parse_user_reply,
user_replied_no,
user_replied_yes,
)
class TestUser(unittest.TestCase):
def setUp(self):
... | 1,120 | Python | .py | 26 | 38.192308 | 77 | 0.710599 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,784 | test_trash_directories_finder.py | andreafrancia_trash-cli/tests/test_put/components/test_trash_directories_finder.py | import unittest
from tests.support.py2mock import Mock
from trashcli.put.core.candidate import Candidate
from trashcli.put.core.check_type import NoCheck, TopTrashDirCheck
from trashcli.put.core.path_maker_type import PathMakerType
from trashcli.put.gate import Gate
from trashcli.put.trash_directories_finder import T... | 2,458 | Python | .py | 44 | 36.045455 | 78 | 0.528263 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,785 | test_make_parser.py | andreafrancia_trash-cli/tests/test_put/components/test_make_parser.py | import unittest
from trashcli.put.core.mode import Mode
from trashcli.put.parser import make_parser
class Test_make_parser(unittest.TestCase):
def setUp(self):
self.parser = make_parser("program-name")
def test(self):
options = self.parser.parse_args([])
assert options.verbose == 0
... | 1,698 | Python | .py | 39 | 35.948718 | 73 | 0.654835 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,786 | test_original_location.py | andreafrancia_trash-cli/tests/test_put/components/test_original_location.py | import os
import unittest
from parameterized import parameterized # type: ignore
from tests.support.put.fake_fs.fake_fs import FakeFs
from trashcli.put.core.path_maker_type import PathMakerType
from trashcli.put.original_location import OriginalLocation
AbsolutePaths = PathMakerType.AbsolutePaths
RelativePaths = Pa... | 1,708 | Python | .py | 33 | 43.575758 | 79 | 0.638655 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,787 | test_octal.py | andreafrancia_trash-cli/tests/test_put/components/test_octal.py | from trashcli.put.octal import octal
class TestOctal:
def test(self):
assert octal(16877) == '0o40755'
| 116 | Python | .py | 4 | 24.75 | 40 | 0.711712 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,788 | test_stat_mode.py | andreafrancia_trash-cli/tests/test_put/components/test_stat_mode.py | import os
from trashcli.put.fs.real_fs import RealFs
from trashcli.put.octal import octal
from tests.support.dirs.temp_dir import temp_dir
temp_dir = temp_dir
class TestStatMode:
def setup_method(self):
self.fs = RealFs()
self.old_umask = os.umask(0o777 - 0o755)
def teardown_method(self):
... | 961 | Python | .py | 24 | 33.583333 | 59 | 0.64086 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,789 | test_gentle_stat_read.py | andreafrancia_trash-cli/tests/test_put/components/test_gentle_stat_read.py | import grp
import os
import pwd
from tests.support.files import make_file
from trashcli.put.reporting.stats_reader import gentle_stat_read
from tests.support.dirs.temp_dir import temp_dir
temp_dir = temp_dir
class TestGentleStatRead:
def test_file_non_found(self, temp_dir):
result = gentle_stat_read(tem... | 947 | Python | .py | 25 | 31.52 | 74 | 0.652412 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,790 | test_suffix.py | andreafrancia_trash-cli/tests/test_put/components/test_suffix.py | from trashcli.put.core.int_generator import IntGenerator
from trashcli.put.suffix import Suffix
class TestSuffix:
def setup_method(self):
self.suffix = Suffix(InlineFakeIntGen(lambda x, y: "%s,%s" % (x, y)))
def test_first_attempt(self):
assert self.suffix.suffix_for_index(0) == ''
def t... | 659 | Python | .py | 16 | 35.1875 | 77 | 0.670866 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,791 | test_parent_path.py | andreafrancia_trash-cli/tests/test_put/components/test_parent_path.py | import os
import unittest
import pytest
from trashcli.put.fs.parent_realpath import ParentRealpathFs
from trashcli.put.fs.real_fs import RealFs
from tests.support.files import make_empty_file, require_empty_dir
from tests.support.dirs.my_path import MyPath
def parent_path(path):
return ParentRealpathFs(RealFs()... | 1,750 | Python | .py | 40 | 36.275 | 72 | 0.631548 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,792 | test_gate.py | andreafrancia_trash-cli/tests/test_put/components/test_gate.py | from trashcli.put.gate import Gate
class TestGate:
def test_gate(self):
assert repr(Gate.SameVolume) == 'Gate.SameVolume'
assert str(Gate.SameVolume) == 'Gate.SameVolume'
assert repr(Gate.HomeFallback) == 'Gate.HomeFallback'
assert str(Gate.HomeFallback) == 'Gate.HomeFallback'
| 316 | Python | .py | 7 | 38.714286 | 61 | 0.700326 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,793 | test_ensure_dir.py | andreafrancia_trash-cli/tests/test_put/components/test_ensure_dir.py | import unittest
from tests.support.put.fake_fs.fake_fs import FakeFs
from tests.support.put.format_mode import format_mode
from trashcli.put.dir_maker import DirMaker
class TestEnsureDir(unittest.TestCase):
def setUp(self):
self.fs = FakeFs('/')
self.dir_maker = DirMaker(self.fs)
def test_ha... | 924 | Python | .py | 20 | 38.75 | 72 | 0.641341 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,794 | test_trash_dir_volume.py | andreafrancia_trash-cli/tests/test_put/components/test_trash_dir_volume.py | import unittest
from tests.support.fakes.fake_volume_of import FakeVolumeOf
from tests.support.put.fake_fs.fake_fs import FakeFs
from trashcli.put.trash_dir_volume_reader import TrashDirVolumeReader
class TestTrashDirVolume(unittest.TestCase):
def setUp(self):
fs = FakeFs()
fs.add_volume('/disk1'... | 530 | Python | .py | 13 | 35.153846 | 73 | 0.719298 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,795 | test_atomic_write.py | andreafrancia_trash-cli/tests/test_put/components/test_atomic_write.py | import errno
import os
import unittest
import pytest
from trashcli.fs import (
atomic_write,
open_for_write_in_exclusive_and_create_mode,
read_file,
)
from tests.support.dirs.my_path import MyPath
@pytest.mark.slow
class Test_atomic_write(unittest.TestCase):
def setUp(self):
self.temp_dir = ... | 1,427 | Python | .py | 43 | 25.55814 | 71 | 0.619256 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,796 | test_stat_user.py | andreafrancia_trash-cli/tests/test_put/components/test_stat_user.py | import os
from trashcli.put.fs.real_fs import RealFs
from tests.support.dirs.temp_dir import temp_dir
temp_dir = temp_dir
class TestStatMode:
def setup_method(self):
self.fs = RealFs()
def test_user(self, temp_dir):
self.fs.touch(temp_dir / 'foo')
stat = self.fs.lstat(temp_dir / 'fo... | 526 | Python | .py | 15 | 29.133333 | 48 | 0.639604 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,797 | test_persist_trashinfo.py | andreafrancia_trash-cli/tests/test_put/components/test_persist_trashinfo.py | # Copyright (C) 2008-2021 Andrea Francia Trivolzio(PV) Italy
import unittest
import pytest
from six import StringIO
from trashcli.fs import read_file
from trashcli.put.fs.real_fs import RealFs
from trashcli.put.janitor_tools.info_file_persister import InfoFilePersister
from trashcli.put.janitor_tools.info_file_persi... | 1,945 | Python | .py | 40 | 41.95 | 81 | 0.713154 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,798 | test_create_trashinfo_basename.py | andreafrancia_trash-cli/tests/test_put/components/test_create_trashinfo_basename.py | from trashcli.put.janitor_tools.info_file_persister import \
create_trashinfo_basename
class TestCreateTrashinfoBasename:
def test_when_file_name_is_not_too_long(self):
assert 'basename_1.trashinfo' == create_trashinfo_basename('basename',
... | 746 | Python | .py | 13 | 40.846154 | 78 | 0.577503 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |
11,799 | test_candidate_shrink_user.py | andreafrancia_trash-cli/tests/test_put/components/test_candidate_shrink_user.py | import unittest
from trashcli.put.core.candidate import Candidate
class TestCandidateShrinkUser(unittest.TestCase):
def setUp(self):
self.environ = {}
def test_should_substitute_tilde_in_place_of_home_dir(self):
self.environ['HOME'] = '/home/user'
self.trash_dir = "/home/user/.local/... | 1,779 | Python | .py | 37 | 40.405405 | 68 | 0.64067 | andreafrancia/trash-cli | 3,580 | 179 | 62 | GPL-2.0 | 9/5/2024, 5:11:26 PM (Europe/Amsterdam) |