Skip to content

Commit

Permalink
adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
larsschwegmann committed Sep 27, 2024
1 parent 2a3cf0d commit e89c71d
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions tests/test_posix_regex_filter.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
from tortoise.contrib import test
from tests import testmodels

@test.requireCapability(dialect="postgres")
class TestPosixRegexFilterPostgres(test.IsolatedTestCase):
tortoise_test_modules = ["tests.testmodels"]

async def test_regex_filter(self):
author = await testmodels.Author.create(name="Johann Wolfgang von Goethe")
self.assertEqual(
set(await testmodels.Author.filter(name__posix_regex="^Johann [a-zA-Z]+ von Goethe$").values_list("name", flat=True)),
{"Johann Wolfgang von Goethe"},
)


@test.requireCapability(dialect="mysql")
class TestPosixRegexFilterPostgres(test.IsolatedTestCase):
tortoise_test_modules = ["tests.testmodels"]
class TestPosixRegexFilter(test.TestCase):

@test.requireCapability(dialect="mysql")
@test.requireCapability(dialect="postgres")
async def test_regex_filter(self):
author = await testmodels.Author.create(name="Johann Wolfgang von Goethe")
self.assertEqual(
set(await testmodels.Author.filter(name__posix_regex="^Johann [a-zA-Z]+ von Goethe$").values_list("name", flat=True)),
{"Johann Wolfgang von Goethe"},
{author.name},
)

0 comments on commit e89c71d

Please sign in to comment.