diff options
| author | Nick Pope <nick.pope@flightdataservices.com> | 2018-08-16 00:45:11 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-08-16 15:44:31 -0400 |
| commit | 328898582267d963d79eb871300a7f4d5f5e5959 (patch) | |
| tree | 86cbe0844f59a5f7887217f28c1a37bcedc86fef /tests/db_functions/test_repeat.py | |
| parent | cd790ed1a6dbdf910c41da44c306ddae6ea6fd4d (diff) | |
Reorganized text db function tests.
Diffstat (limited to 'tests/db_functions/test_repeat.py')
| -rw-r--r-- | tests/db_functions/test_repeat.py | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/tests/db_functions/test_repeat.py b/tests/db_functions/test_repeat.py deleted file mode 100644 index d3f294c409..0000000000 --- a/tests/db_functions/test_repeat.py +++ /dev/null @@ -1,24 +0,0 @@ -from django.db.models import CharField, Value -from django.db.models.functions import Length, Repeat -from django.test import TestCase - -from .models import Author - - -class RepeatTests(TestCase): - def test_basic(self): - Author.objects.create(name='John', alias='xyz') - tests = ( - (Repeat('name', 0), ''), - (Repeat('name', 2), 'JohnJohn'), - (Repeat('name', Length('alias'), output_field=CharField()), 'JohnJohnJohn'), - (Repeat(Value('x'), 3, output_field=CharField()), 'xxx'), - ) - for function, repeated_text in tests: - with self.subTest(function=function): - authors = Author.objects.annotate(repeated_text=function) - self.assertQuerysetEqual(authors, [repeated_text], lambda a: a.repeated_text, ordered=False) - - def test_negative_number(self): - with self.assertRaisesMessage(ValueError, "'number' must be greater or equal to 0."): - Repeat('name', -1) |
