Esempio n. 1
0
 def test_discard(self):
     s = mappings.OrderedSet()
     s.discard('a')
     s.add('a')
     assert s
     s.discard('a')
     assert not s
Esempio n. 2
0
 def test_add(self):
     s = mappings.OrderedSet()
     s.add('a')
     assert 'a' in s
     s.add(1)
     assert 1 in s
     assert list(s) == ['a', 1]
Esempio n. 3
0
 def test_clear(self):
     s = mappings.OrderedSet()
     s.clear()
     assert len(s) == 0
     s.add('a')
     assert len(s) == 1
     s.clear()
     assert len(s) == 0
Esempio n. 4
0
 def test_remove(self):
     s = mappings.OrderedSet()
     with pytest.raises(KeyError):
         s.remove('a')
     s.add('a')
     assert 'a' in s
     s.remove('a')
     assert 'a' not in s
Esempio n. 5
0
 def test_update(self):
     s = mappings.OrderedSet()
     with pytest.raises(TypeError):
         s.update()
     s.update(range(9))
     assert len(s) == 9
Esempio n. 6
0
 def test_hash(self):
     with pytest.raises(TypeError):
         assert hash(mappings.OrderedSet('set'))