diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /library/python/resource/ut | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'library/python/resource/ut')
-rw-r--r-- | library/python/resource/ut/lib/qw.txt | 1 | ||||
-rw-r--r-- | library/python/resource/ut/lib/test_simple.py | 31 | ||||
-rw-r--r-- | library/python/resource/ut/lib/ya.make | 17 | ||||
-rw-r--r-- | library/python/resource/ut/py2/ya.make | 9 | ||||
-rw-r--r-- | library/python/resource/ut/py3/ya.make | 9 | ||||
-rw-r--r-- | library/python/resource/ut/ya.make | 6 |
6 files changed, 73 insertions, 0 deletions
diff --git a/library/python/resource/ut/lib/qw.txt b/library/python/resource/ut/lib/qw.txt new file mode 100644 index 00000000000..50e37d5cac5 --- /dev/null +++ b/library/python/resource/ut/lib/qw.txt @@ -0,0 +1 @@ +na gorshke sidel korol diff --git a/library/python/resource/ut/lib/test_simple.py b/library/python/resource/ut/lib/test_simple.py new file mode 100644 index 00000000000..52f006ff919 --- /dev/null +++ b/library/python/resource/ut/lib/test_simple.py @@ -0,0 +1,31 @@ +import six # noqa + +import library.python.resource as rs + +text = b'na gorshke sidel korol\n' + + +def test_find(): + assert rs.find('/qw.txt') == text + + +def test_iter(): + assert set(rs.iterkeys()).issuperset({'/qw.txt', '/prefix/1.txt', '/prefix/2.txt'}) + assert set(rs.iterkeys(prefix='/prefix/')) == {'/prefix/1.txt', '/prefix/2.txt'} + assert set(rs.iterkeys(prefix='/prefix/', strip_prefix=True)) == {'1.txt', '2.txt'} + assert set(rs.iteritems(prefix='/prefix')) == { + ('/prefix/1.txt', text), + ('/prefix/2.txt', text), + } + assert set(rs.iteritems(prefix='/prefix', strip_prefix=True)) == { + ('/1.txt', text), + ('/2.txt', text), + } + + +def test_resfs_files(): + assert 'contrib/python/py/.dist-info/METADATA' in set(rs.resfs_files()) + + +def test_resfs_read(): + assert 'Metadata-Version' in rs.resfs_read('contrib/python/py/.dist-info/METADATA').decode('utf-8') diff --git a/library/python/resource/ut/lib/ya.make b/library/python/resource/ut/lib/ya.make new file mode 100644 index 00000000000..693e388878c --- /dev/null +++ b/library/python/resource/ut/lib/ya.make @@ -0,0 +1,17 @@ +PY23_LIBRARY() + +OWNER(pg) + +TEST_SRCS(test_simple.py) + +PEERDIR( + library/python/resource +) + +RESOURCE( + qw.txt /qw.txt + qw.txt /prefix/1.txt + qw.txt /prefix/2.txt +) + +END() diff --git a/library/python/resource/ut/py2/ya.make b/library/python/resource/ut/py2/ya.make new file mode 100644 index 00000000000..5085610fafa --- /dev/null +++ b/library/python/resource/ut/py2/ya.make @@ -0,0 +1,9 @@ +PY2TEST() + +OWNER(pg) + +PEERDIR( + library/python/resource/ut/lib +) + +END() diff --git a/library/python/resource/ut/py3/ya.make b/library/python/resource/ut/py3/ya.make new file mode 100644 index 00000000000..64eb2e83ce0 --- /dev/null +++ b/library/python/resource/ut/py3/ya.make @@ -0,0 +1,9 @@ +PY3TEST() + +OWNER(pg) + +PEERDIR( + library/python/resource/ut/lib +) + +END() diff --git a/library/python/resource/ut/ya.make b/library/python/resource/ut/ya.make new file mode 100644 index 00000000000..a5ec192d743 --- /dev/null +++ b/library/python/resource/ut/ya.make @@ -0,0 +1,6 @@ +OWNER(pg) + +RECURSE( + py2 + py3 +) |