diff options
author | monster <monster@ydb.tech> | 2022-07-07 14:41:37 +0300 |
---|---|---|
committer | monster <monster@ydb.tech> | 2022-07-07 14:41:37 +0300 |
commit | 06e5c21a835c0e923506c4ff27929f34e00761c2 (patch) | |
tree | 75efcbc6854ef9bd476eb8bf00cc5c900da436a2 /contrib/python/prompt-toolkit/py3/tests/test_utils.py | |
parent | 03f024c4412e3aa613bb543cf1660176320ba8f4 (diff) | |
download | ydb-06e5c21a835c0e923506c4ff27929f34e00761c2.tar.gz |
fix ya.make
Diffstat (limited to 'contrib/python/prompt-toolkit/py3/tests/test_utils.py')
-rw-r--r-- | contrib/python/prompt-toolkit/py3/tests/test_utils.py | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/contrib/python/prompt-toolkit/py3/tests/test_utils.py b/contrib/python/prompt-toolkit/py3/tests/test_utils.py deleted file mode 100644 index 6a1c17955c..0000000000 --- a/contrib/python/prompt-toolkit/py3/tests/test_utils.py +++ /dev/null @@ -1,76 +0,0 @@ -import itertools - -import pytest - -from prompt_toolkit.utils import take_using_weights - - -def test_using_weights(): - def take(generator, count): - return list(itertools.islice(generator, 0, count)) - - # Check distribution. - data = take(take_using_weights(["A", "B", "C"], [5, 10, 20]), 35) - assert data.count("A") == 5 - assert data.count("B") == 10 - assert data.count("C") == 20 - - assert data == [ - "A", - "B", - "C", - "C", - "B", - "C", - "C", - "A", - "B", - "C", - "C", - "B", - "C", - "C", - "A", - "B", - "C", - "C", - "B", - "C", - "C", - "A", - "B", - "C", - "C", - "B", - "C", - "C", - "A", - "B", - "C", - "C", - "B", - "C", - "C", - ] - - # Another order. - data = take(take_using_weights(["A", "B", "C"], [20, 10, 5]), 35) - assert data.count("A") == 20 - assert data.count("B") == 10 - assert data.count("C") == 5 - - # Bigger numbers. - data = take(take_using_weights(["A", "B", "C"], [20, 10, 5]), 70) - assert data.count("A") == 40 - assert data.count("B") == 20 - assert data.count("C") == 10 - - # Negative numbers. - data = take(take_using_weights(["A", "B", "C"], [-20, 10, 0]), 70) - assert data.count("A") == 0 - assert data.count("B") == 70 - assert data.count("C") == 0 - - # All zero-weight items. - with pytest.raises(ValueError): - take(take_using_weights(["A", "B", "C"], [0, 0, 0]), 70) |