Increased test coverage for django.utils.datastructures.OrderedSet.

Co-authored-by: Nick Pope <nick.pope@flightdataservices.com>
This commit is contained in:
Mads Jensen 2020-02-10 19:41:38 +01:00 committed by Mariusz Felisiak
parent 384ac0990f
commit 825f8470f5
1 changed files with 26 additions and 0 deletions

View File

@ -13,6 +13,32 @@ from django.utils.datastructures import (
class OrderedSetTests(SimpleTestCase):
def test_init_with_iterable(self):
s = OrderedSet([1, 2, 3])
self.assertEqual(list(s.dict.keys()), [1, 2, 3])
def test_remove(self):
s = OrderedSet()
self.assertEqual(len(s), 0)
s.add(1)
s.add(2)
s.remove(2)
self.assertEqual(len(s), 1)
self.assertNotIn(2, s)
def test_discard(self):
s = OrderedSet()
self.assertEqual(len(s), 0)
s.add(1)
s.discard(2)
self.assertEqual(len(s), 1)
def test_contains(self):
s = OrderedSet()
self.assertEqual(len(s), 0)
s.add(1)
self.assertIn(1, s)
def test_bool(self):
# Refs #23664
s = OrderedSet()