mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
Added tests for Combinable's bitwise logical operation errors.
This commit is contained in:
parent
50de55f399
commit
81d5320db5
@ -10,8 +10,8 @@ from django.db.models.aggregates import (
|
|||||||
Avg, Count, Max, Min, StdDev, Sum, Variance,
|
Avg, Count, Max, Min, StdDev, Sum, Variance,
|
||||||
)
|
)
|
||||||
from django.db.models.expressions import (
|
from django.db.models.expressions import (
|
||||||
Case, Col, Exists, ExpressionList, ExpressionWrapper, F, Func, OrderBy,
|
Case, Col, Combinable, Exists, ExpressionList, ExpressionWrapper, F, Func,
|
||||||
OuterRef, Random, RawSQL, Ref, Subquery, Value, When,
|
OrderBy, OuterRef, Random, RawSQL, Ref, Subquery, Value, When,
|
||||||
)
|
)
|
||||||
from django.db.models.functions import (
|
from django.db.models.functions import (
|
||||||
Coalesce, Concat, Length, Lower, Substr, Upper,
|
Coalesce, Concat, Length, Lower, Substr, Upper,
|
||||||
@ -1387,3 +1387,23 @@ class ReprTests(TestCase):
|
|||||||
repr(Variance('a', sample=True, filter=filter)),
|
repr(Variance('a', sample=True, filter=filter)),
|
||||||
"Variance(F(a), filter=(AND: ('a', 1)), sample=True)"
|
"Variance(F(a), filter=(AND: ('a', 1)), sample=True)"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class CombinableTests(SimpleTestCase):
|
||||||
|
bitwise_msg = 'Use .bitand() and .bitor() for bitwise logical operations.'
|
||||||
|
|
||||||
|
def test_and(self):
|
||||||
|
with self.assertRaisesMessage(NotImplementedError, self.bitwise_msg):
|
||||||
|
Combinable() & Combinable()
|
||||||
|
|
||||||
|
def test_or(self):
|
||||||
|
with self.assertRaisesMessage(NotImplementedError, self.bitwise_msg):
|
||||||
|
Combinable() | Combinable()
|
||||||
|
|
||||||
|
def test_reversed_and(self):
|
||||||
|
with self.assertRaisesMessage(NotImplementedError, self.bitwise_msg):
|
||||||
|
object() & Combinable()
|
||||||
|
|
||||||
|
def test_reversed_or(self):
|
||||||
|
with self.assertRaisesMessage(NotImplementedError, self.bitwise_msg):
|
||||||
|
object() | Combinable()
|
||||||
|
Loading…
Reference in New Issue
Block a user