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/lib/test_simple.py | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'library/python/resource/ut/lib/test_simple.py')
-rw-r--r-- | library/python/resource/ut/lib/test_simple.py | 31 |
1 files changed, 31 insertions, 0 deletions
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 0000000000..52f006ff91 --- /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') |