mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Thanks Mariusz Felisiak and Simon Charette for reviews.
This commit is contained in:
committed by
Mariusz Felisiak
parent
e46ca51c24
commit
8b040e3cbb
@@ -25,7 +25,9 @@ from django.db.models.functions import (
|
||||
from django.db.models.sql import constants
|
||||
from django.db.models.sql.datastructures import Join
|
||||
from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature
|
||||
from django.test.utils import Approximate, CaptureQueriesContext, isolate_apps
|
||||
from django.test.utils import (
|
||||
Approximate, CaptureQueriesContext, isolate_apps, register_lookup,
|
||||
)
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
|
||||
from .models import (
|
||||
@@ -1216,6 +1218,12 @@ class ExpressionOperatorTests(TestCase):
|
||||
self.assertEqual(Number.objects.get(pk=self.n.pk).integer, 58)
|
||||
self.assertEqual(Number.objects.get(pk=self.n1.pk).integer, -10)
|
||||
|
||||
def test_lefthand_transformed_field_bitwise_or(self):
|
||||
Employee.objects.create(firstname='Max', lastname='Mustermann')
|
||||
with register_lookup(CharField, Length):
|
||||
qs = Employee.objects.annotate(bitor=F('lastname__length').bitor(48))
|
||||
self.assertEqual(qs.get().bitor, 58)
|
||||
|
||||
def test_lefthand_power(self):
|
||||
# LH Power arithmetic operation on floats and integers
|
||||
Number.objects.filter(pk=self.n.pk).update(integer=F('integer') ** 2, float=F('float') ** 1.5)
|
||||
|
||||
Reference in New Issue
Block a user