diff options
author | Aleksandr <ivansduck@gmail.com> | 2022-02-10 16:47:52 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:52 +0300 |
commit | b05913d1c3c02a773578bceb7285084d2933ae86 (patch) | |
tree | c0748b5dcbade83af788c0abfa89c0383d6b779c /library/python/fs/test/test_fs.py | |
parent | ea6c5b7f172becca389cacaff7d5f45f6adccbe6 (diff) | |
download | ydb-b05913d1c3c02a773578bceb7285084d2933ae86.tar.gz |
Restoring authorship annotation for Aleksandr <ivansduck@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/python/fs/test/test_fs.py')
-rw-r--r-- | library/python/fs/test/test_fs.py | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/library/python/fs/test/test_fs.py b/library/python/fs/test/test_fs.py index 5c1c6030b5..9e2c70c069 100644 --- a/library/python/fs/test/test_fs.py +++ b/library/python/fs/test/test_fs.py @@ -18,16 +18,16 @@ def in_env(case): def wrapped_case(*args, **kwargs): with library.python.tmp.temp_dir() as temp_dir: case(lambda path: os.path.join(temp_dir, path)) - + return wrapped_case def mkfile(path, data=''): with open(path, 'wb') as f: if data: - f.write(data) if isinstance(data, six.binary_type) else f.write( - data.encode(library.python.strings.fs_encoding()) - ) + f.write(data) if isinstance(data, six.binary_type) else f.write( + data.encode(library.python.strings.fs_encoding()) + ) def mktree_example(path, name): @@ -820,20 +820,20 @@ def test_read_file_empty(path): @in_env def test_read_file_multiline(path): mkfile(path('src'), 'SRC line 1\nSRC line 2\n') - assert ( - library.python.fs.read_file(path('src')).decode(library.python.strings.fs_encoding()) - == 'SRC line 1\nSRC line 2\n' - ) + assert ( + library.python.fs.read_file(path('src')).decode(library.python.strings.fs_encoding()) + == 'SRC line 1\nSRC line 2\n' + ) assert library.python.fs.read_file(path('src'), binary=False) == 'SRC line 1\nSRC line 2\n' @in_env def test_read_file_multiline_crlf(path): mkfile(path('src'), 'SRC line 1\r\nSRC line 2\r\n') - assert ( - library.python.fs.read_file(path('src')).decode(library.python.strings.fs_encoding()) - == 'SRC line 1\r\nSRC line 2\r\n' - ) + assert ( + library.python.fs.read_file(path('src')).decode(library.python.strings.fs_encoding()) + == 'SRC line 1\r\nSRC line 2\r\n' + ) if library.python.windows.on_win() or six.PY3: # universal newlines are by default in text mode in python3 assert library.python.fs.read_file(path('src'), binary=False) == 'SRC line 1\nSRC line 2\n' else: @@ -1005,9 +1005,9 @@ def test_copy_tree_custom_copy_function(): shutil.copy2(src, dst) copied.append(dst) - library.python.fs.copy_tree( - "test_copy_tree_src", yatest.common.work_path("test_copy_tree_dst"), copy_function=copy_function - ) + library.python.fs.copy_tree( + "test_copy_tree_src", yatest.common.work_path("test_copy_tree_dst"), copy_function=copy_function + ) assert len(copied) == 2 assert yatest.common.work_path("test_copy_tree_dst/deepper/deepper.txt") in copied assert yatest.common.work_path("test_copy_tree_dst/deepper/inner/inner.txt") in copied @@ -1019,19 +1019,19 @@ def test_copy2(): assert os.path.islink("link2") assert os.readlink("link2") == "non-existent" - - -def test_commonpath(): - pj = os.path.join - pja = lambda *x: os.path.abspath(pj(*x)) - - assert library.python.fs.commonpath(['a', 'b']) == '' - assert library.python.fs.commonpath([pj('t', '1')]) == pj('t', '1') - assert library.python.fs.commonpath([pj('t', '1'), pj('t', '2')]) == pj('t') - assert library.python.fs.commonpath([pj('t', '1', '2'), pj('t', '1', '2')]) == pj('t', '1', '2') - assert library.python.fs.commonpath([pj('t', '1', '1'), pj('t', '1', '2')]) == pj('t', '1') - assert library.python.fs.commonpath([pj('t', '1', '1'), pj('t', '1', '2'), pj('t', '1', '3')]) == pj('t', '1') - - assert library.python.fs.commonpath([pja('t', '1', '1'), pja('t', '1', '2')]) == pja('t', '1') - - assert library.python.fs.commonpath({pj('t', '1'), pj('t', '2')}) == pj('t') + + +def test_commonpath(): + pj = os.path.join + pja = lambda *x: os.path.abspath(pj(*x)) + + assert library.python.fs.commonpath(['a', 'b']) == '' + assert library.python.fs.commonpath([pj('t', '1')]) == pj('t', '1') + assert library.python.fs.commonpath([pj('t', '1'), pj('t', '2')]) == pj('t') + assert library.python.fs.commonpath([pj('t', '1', '2'), pj('t', '1', '2')]) == pj('t', '1', '2') + assert library.python.fs.commonpath([pj('t', '1', '1'), pj('t', '1', '2')]) == pj('t', '1') + assert library.python.fs.commonpath([pj('t', '1', '1'), pj('t', '1', '2'), pj('t', '1', '3')]) == pj('t', '1') + + assert library.python.fs.commonpath([pja('t', '1', '1'), pja('t', '1', '2')]) == pja('t', '1') + + assert library.python.fs.commonpath({pj('t', '1'), pj('t', '2')}) == pj('t') |