1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Used AND, OR, XOR constants instead of hard-coded values.

This commit is contained in:
Nick Pope
2022-07-23 13:31:35 +01:00
committed by Mariusz Felisiak
parent e20e5d1557
commit 769d7cce4a
6 changed files with 20 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
import copy
import unittest
from django.db.models.sql import AND, OR
from django.utils.tree import Node
@@ -56,9 +57,9 @@ class NodeTests(unittest.TestCase):
self.assertEqual(str(node3), "(DEFAULT: ('a', 1), ('b', 2), ('c', 3))")
def test_add_eq_child_mixed_connector(self):
node = Node(["a", "b"], "OR")
self.assertEqual(node.add("a", "AND"), "a")
self.assertEqual(node, Node([Node(["a", "b"], "OR"), "a"], "AND"))
node = Node(["a", "b"], OR)
self.assertEqual(node.add("a", AND), "a")
self.assertEqual(node, Node([Node(["a", "b"], OR), "a"], AND))
def test_negate(self):
# negated is False by default