File: test_exists.py

package info (click to toggle)
python-beanie 2.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,480 kB
  • sloc: python: 14,427; makefile: 7; sh: 6
file content (15 lines) | stat: -rw-r--r-- 494 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from tests.odm.models import DocumentTestModel


async def test_count_with_filter_query(documents):
    await documents(4, "uno", True)
    await documents(2, "dos", True)
    await documents(1, "cuatro", True)
    e = await DocumentTestModel.find_many({"test_str": "dos"}).exists()
    assert e is True

    e = await DocumentTestModel.find_one({"test_str": "dos"}).exists()
    assert e is True

    e = await DocumentTestModel.find_many({"test_str": "wrong"}).exists()
    assert e is False