diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /library/python/runtime_py3/test/test_resources.py | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/python/runtime_py3/test/test_resources.py')
-rw-r--r-- | library/python/runtime_py3/test/test_resources.py | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/library/python/runtime_py3/test/test_resources.py b/library/python/runtime_py3/test/test_resources.py index 8eb05380a5..a269329f42 100644 --- a/library/python/runtime_py3/test/test_resources.py +++ b/library/python/runtime_py3/test/test_resources.py @@ -1,60 +1,60 @@ -# -*- coding: utf-8 -*- - -import importlib.resources as ir - -import pytest - - -@pytest.mark.parametrize("package, resource", ( - ("resources", "foo.txt"), - ("resources.submodule", "bar.txt") -)) -def test_is_resource_good_path(package, resource): - assert ir.is_resource(package, resource) - - -@pytest.mark.parametrize("package, resource", ( - ("resources", "111.txt"), - ("resources.submodule", "222.txt") -)) -def test_is_resource_missing(package, resource): - assert not ir.is_resource(package, resource) - - -def test_is_resource_subresource_directory(): - # Directories are not resources. - assert not ir.is_resource("resources", "submodule") - - -@pytest.mark.parametrize("package, resource, expected", ( - ("resources", "foo.txt", b"bar"), - ("resources.submodule", "bar.txt", b"foo") -)) -def test_read_binary_good_path(package, resource, expected): - assert ir.read_binary(package, resource) == expected - - -def test_read_binary_missing(): - with pytest.raises(FileNotFoundError): - ir.read_binary("resources", "111.txt") - - -@pytest.mark.parametrize("package, resource, expected", ( - ("resources", "foo.txt", "bar"), - ("resources.submodule", "bar.txt", "foo") -)) -def test_read_text_good_path(package, resource, expected): - assert ir.read_text(package, resource) == expected - - -def test_read_text_missing(): - with pytest.raises(FileNotFoundError): - ir.read_text("resources", "111.txt") - - -@pytest.mark.parametrize("package, expected", ( - ("resources", ["submodule", "foo.txt"]), - ("resources.submodule", ["bar.txt"]) -)) -def test_contents_good_path(package, expected): - assert sorted(ir.contents(package)) == sorted(expected) +# -*- coding: utf-8 -*- + +import importlib.resources as ir + +import pytest + + +@pytest.mark.parametrize("package, resource", ( + ("resources", "foo.txt"), + ("resources.submodule", "bar.txt") +)) +def test_is_resource_good_path(package, resource): + assert ir.is_resource(package, resource) + + +@pytest.mark.parametrize("package, resource", ( + ("resources", "111.txt"), + ("resources.submodule", "222.txt") +)) +def test_is_resource_missing(package, resource): + assert not ir.is_resource(package, resource) + + +def test_is_resource_subresource_directory(): + # Directories are not resources. + assert not ir.is_resource("resources", "submodule") + + +@pytest.mark.parametrize("package, resource, expected", ( + ("resources", "foo.txt", b"bar"), + ("resources.submodule", "bar.txt", b"foo") +)) +def test_read_binary_good_path(package, resource, expected): + assert ir.read_binary(package, resource) == expected + + +def test_read_binary_missing(): + with pytest.raises(FileNotFoundError): + ir.read_binary("resources", "111.txt") + + +@pytest.mark.parametrize("package, resource, expected", ( + ("resources", "foo.txt", "bar"), + ("resources.submodule", "bar.txt", "foo") +)) +def test_read_text_good_path(package, resource, expected): + assert ir.read_text(package, resource) == expected + + +def test_read_text_missing(): + with pytest.raises(FileNotFoundError): + ir.read_text("resources", "111.txt") + + +@pytest.mark.parametrize("package, expected", ( + ("resources", ["submodule", "foo.txt"]), + ("resources.submodule", ["bar.txt"]) +)) +def test_contents_good_path(package, expected): + assert sorted(ir.contents(package)) == sorted(expected) |