diff options
author | Christian Heimes <christian@cheimes.de> | 2007-12-10 15:50:56 +0000 |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2007-12-10 15:50:56 +0000 |
commit | 0ded5b54bb499865fb4ab8c0ac3d0977df9a334d (patch) | |
tree | a395f726d50a71b1bf363d5a041224ad51e80691 /Lib/test/test_set.py | |
parent | 110194048e2d6a42f5954c39c8646ba93b66a7e1 (diff) | |
download | cpython-git-0ded5b54bb499865fb4ab8c0ac3d0977df9a334d.tar.gz |
Fixed issue #1564: The set implementation should special-case PyUnicode instead of PyString
I moved the unicode_eq to stringlib/eq.h to keep the function static and possible inline for setobject.c and dictobject.h. I also removed the unused _PyString_Eq method. If it's required in the future it can be added to eq.h
Diffstat (limited to 'Lib/test/test_set.py')
-rw-r--r-- | Lib/test/test_set.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py index ba5801d772..e761f19c1e 100644 --- a/Lib/test/test_set.py +++ b/Lib/test/test_set.py @@ -7,6 +7,7 @@ import pickle import os from random import randrange, shuffle import sys +import warnings class PassThru(Exception): pass @@ -817,6 +818,44 @@ class TestBasicOpsTriple(TestBasicOps): self.length = 3 self.repr = None +#------------------------------------------------------------------------------ + +class TestBasicOpsString(TestBasicOps): + def setUp(self): + self.case = "string set" + self.values = ["a", "b", "c"] + self.set = set(self.values) + self.dup = set(self.values) + self.length = 3 + self.repr = "{'a', 'c', 'b'}" + +#------------------------------------------------------------------------------ + +class TestBasicOpsBytes(TestBasicOps): + def setUp(self): + self.case = "string set" + self.values = [b"a", b"b", b"c"] + self.set = set(self.values) + self.dup = set(self.values) + self.length = 3 + self.repr = "{b'a', b'c', b'b'}" + +#------------------------------------------------------------------------------ + +class TestBasicOpsMixedStringBytes(TestBasicOps): + def setUp(self): + self.warning_filters = warnings.filters[:] + warnings.simplefilter('ignore', BytesWarning) + self.case = "string and bytes set" + self.values = ["a", "b", b"a", b"b"] + self.set = set(self.values) + self.dup = set(self.values) + self.length = 4 + self.repr = "{'a', b'a', 'b', b'b'}" + + def tearDown(self): + warnings.filters = self.warning_filters + #============================================================================== def baditer(): @@ -1581,6 +1620,9 @@ def test_main(verbose=None): TestBasicOpsSingleton, TestBasicOpsTuple, TestBasicOpsTriple, + TestBasicOpsString, + TestBasicOpsBytes, + TestBasicOpsMixedStringBytes, TestBinaryOps, TestUpdateOps, TestMutate, |