diff options
author | dvshkurko <dvshkurko@yandex-team.ru> | 2022-02-10 16:45:52 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:52 +0300 |
commit | c768a99151e47c3a4bb7b92c514d256abd301c4d (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/python/fs/test | |
parent | 321ee9bce31ec6e238be26dbcbe539cffa2c3309 (diff) | |
download | ydb-c768a99151e47c3a4bb7b92c514d256abd301c4d.tar.gz |
Restoring authorship annotation for <dvshkurko@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/python/fs/test')
-rw-r--r-- | library/python/fs/test/test_fs.py | 46 | ||||
-rw-r--r-- | library/python/fs/test/ya.make | 2 |
2 files changed, 24 insertions, 24 deletions
diff --git a/library/python/fs/test/test_fs.py b/library/python/fs/test/test_fs.py index 00bd7e3d29..9e2c70c069 100644 --- a/library/python/fs/test/test_fs.py +++ b/library/python/fs/test/test_fs.py @@ -4,10 +4,10 @@ import errno import os import pytest import shutil -import six +import six import library.python.fs -import library.python.strings +import library.python.strings import library.python.tmp import library.python.windows @@ -23,7 +23,7 @@ def in_env(case): def mkfile(path, data=''): - with open(path, 'wb') as f: + 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()) @@ -40,8 +40,8 @@ def mktree_example(path, name): def file_data(path): - with open(path, 'rb') as f: - return f.read().decode('utf-8') + with open(path, 'rb') as f: + return f.read().decode('utf-8') def serialize_tree(path): @@ -92,8 +92,8 @@ def test_errorfix_win(): erroneous_func() assert errinfo.value.errno == errno.EACCES assert errinfo.value.filename == 'unknown/file' - # See transcode_error, which encodes strerror, in library/python/windows/__init__.py - assert isinstance(errinfo.value.strerror, (six.binary_type, six.text_type)) + # See transcode_error, which encodes strerror, in library/python/windows/__init__.py + assert isinstance(errinfo.value.strerror, (six.binary_type, six.text_type)) assert errinfo.value.strerror @@ -101,8 +101,8 @@ def test_custom_fs_error(): with pytest.raises(OSError) as errinfo: raise library.python.fs.CustomFsError(errno.EACCES, filename='some/file') assert errinfo.value.errno == errno.EACCES - # See transcode_error, which encodes strerror, in library/python/windows/__init__.py - assert isinstance(errinfo.value.strerror, (six.binary_type, six.text_type)) + # See transcode_error, which encodes strerror, in library/python/windows/__init__.py + assert isinstance(errinfo.value.strerror, (six.binary_type, six.text_type)) assert errinfo.value.filename == 'some/file' @@ -806,14 +806,14 @@ def test_copy_tree_file_exists(path): @in_env def test_read_file(path): mkfile(path('src'), 'SRC') - assert library.python.fs.read_file(path('src')).decode(library.python.strings.fs_encoding()) == 'SRC' + assert library.python.fs.read_file(path('src')).decode(library.python.strings.fs_encoding()) == 'SRC' assert library.python.fs.read_file(path('src'), binary=False) == 'SRC' @in_env def test_read_file_empty(path): mkfile(path('src')) - assert library.python.fs.read_file(path('src')).decode(library.python.strings.fs_encoding()) == '' + assert library.python.fs.read_file(path('src')).decode(library.python.strings.fs_encoding()) == '' assert library.python.fs.read_file(path('src'), binary=False) == '' @@ -834,7 +834,7 @@ def test_read_file_multiline_crlf(path): 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 + 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: assert library.python.fs.read_file(path('src'), binary=False) == 'SRC line 1\r\nSRC line 2\r\n' @@ -879,7 +879,7 @@ def test_read_file_unicode_multiline_crlf(path): mkfile(path('src_cp1251'), s.encode('cp1251')) assert library.python.fs.read_file_unicode(path('src')) == s assert library.python.fs.read_file_unicode(path('src_cp1251'), enc='cp1251') == s - if library.python.windows.on_win() or six.PY3: # universal newlines are by default in text mode in python3 + 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_unicode(path('src'), binary=False) == u'АБВ\nИ еще\n' assert library.python.fs.read_file_unicode(path('src_cp1251'), binary=False, enc='cp1251') == u'АБВ\nИ еще\n' else: @@ -984,14 +984,14 @@ def test_hardlink_or_copy(): def test_remove_tree_unicode(): path = u"test_remove_tree_unicode/русский".encode("utf-8") os.makedirs(path) - library.python.fs.remove_tree(six.text_type("test_remove_tree_unicode")) + library.python.fs.remove_tree(six.text_type("test_remove_tree_unicode")) assert not os.path.exists("test_remove_tree_unicode") def test_remove_tree_safe_unicode(): path = u"test_remove_tree_safe_unicode/русский".encode("utf-8") os.makedirs(path) - library.python.fs.remove_tree_safe(six.text_type("test_remove_tree_safe_unicode")) + library.python.fs.remove_tree_safe(six.text_type("test_remove_tree_safe_unicode")) assert not os.path.exists("test_remove_tree_safe_unicode") @@ -1011,14 +1011,14 @@ def test_copy_tree_custom_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 - - -def test_copy2(): - library.python.fs.symlink("non-existent", "link") - library.python.fs.copy2("link", "link2", follow_symlinks=False) - - assert os.path.islink("link2") - assert os.readlink("link2") == "non-existent" + + +def test_copy2(): + library.python.fs.symlink("non-existent", "link") + library.python.fs.copy2("link", "link2", follow_symlinks=False) + + assert os.path.islink("link2") + assert os.readlink("link2") == "non-existent" def test_commonpath(): diff --git a/library/python/fs/test/ya.make b/library/python/fs/test/ya.make index b0e636c446..33e3f5b4ff 100644 --- a/library/python/fs/test/ya.make +++ b/library/python/fs/test/ya.make @@ -1,6 +1,6 @@ OWNER(g:yatool) -PY23_TEST() +PY23_TEST() TEST_SRCS( test_fs.py |