mirror of
https://github.com/django/django.git
synced 2025-10-08 09:40:35 +00:00
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.
This commit is contained in:
parent
2e5b2c612e
commit
b962653060
3 changed files with 19 additions and 3 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue