summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_datastructures.py
diff options
context:
space:
mode:
authorThomas Chaumeny <thomas.chaumeny@polyconseil.fr>2014-10-16 12:43:46 +0200
committerBaptiste Mispelon <bmispelon@gmail.com>2014-10-16 14:16:24 +0200
commitb962653060f1968f5a2647b8a20259dc30a3433f (patch)
tree8a82b9029c9f55ed8bd3ff82f2b4c8b9c60e30d0 /tests/utils_tests/test_datastructures.py
parent2e5b2c612ec3b410d2a35133d073341e6958eeba (diff)
downloaddjango-b962653060f1968f5a2647b8a20259dc30a3433f.tar.gz
Fixed #23664 -- Provided a consistent definition for OrderedSet.__bool__
This also defines QuerySet.__bool__ for consistency though this should not have any consequence as bool(qs) used to fallback on QuerySet.__len__ in Py3.
Diffstat (limited to 'tests/utils_tests/test_datastructures.py')
-rw-r--r--tests/utils_tests/test_datastructures.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/utils_tests/test_datastructures.py b/tests/utils_tests/test_datastructures.py
index a163310e19..ec4001cafc 100644
--- a/tests/utils_tests/test_datastructures.py
+++ b/tests/utils_tests/test_datastructures.py
@@ -8,7 +8,7 @@ import pickle
from django.test import SimpleTestCase
from django.test.utils import IgnoreDeprecationWarningsMixin
from django.utils.datastructures import (DictWrapper, ImmutableList,
- MultiValueDict, MultiValueDictKeyError, MergeDict, SortedDict)
+ MultiValueDict, MultiValueDictKeyError, MergeDict, OrderedSet, SortedDict)
from django.utils import six
@@ -206,6 +206,16 @@ class MergeDictTests(IgnoreDeprecationWarningsMixin, SimpleTestCase):
d1['key2']
+class OrderedSetTests(SimpleTestCase):
+
+ def test_bool(self):
+ # Refs #23664
+ s = OrderedSet()
+ self.assertFalse(s)
+ s.add(1)
+ self.assertTrue(s)
+
+
class MultiValueDictTests(SimpleTestCase):
def test_multivaluedict(self):