Skip to content

Commit

Permalink
Issue #112: Prepare Stackless 3.5, fix test_dictviews, test_generator…
Browse files Browse the repository at this point in the history
…s and test_xml_etree

Disable the recently added test methods test_copy() and test_pickle() in test_dictviews, test_generators and test_xml_etree. Theses test assure that objects can't be copied or pickled, but Stackless can copy/pickle them.

https://bitbucket.org/stackless-dev/stackless/issues/112
  • Loading branch information
Anselm Kruis committed Apr 14, 2017
1 parent 643681c commit bf6be12
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Lib/test/test_dictviews.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import copy
import pickle
import unittest
import test.support

class DictSetTest(unittest.TestCase):

Expand Down Expand Up @@ -199,12 +200,14 @@ def test_recursive_repr(self):
d[42] = d.values()
self.assertRaises(RecursionError, repr, d)

@unittest.skipIf(test.support.stackless, "Stackless can copy dictviews")
def test_copy(self):
d = {1: 10, "a": "ABC"}
self.assertRaises(TypeError, copy.copy, d.keys())
self.assertRaises(TypeError, copy.copy, d.values())
self.assertRaises(TypeError, copy.copy, d.items())

@unittest.skipIf(test.support.stackless, "Stackless can pickle dictviews")
def test_pickle(self):
d = {1: 10, "a": "ABC"}
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/test_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,15 @@ def func():
self.assertEqual(gen.__qualname__,
"GeneratorTest.test_name.<locals>.<genexpr>")

@unittest.skipIf(support.stackless, "Stackless can copy generators")
def test_copy(self):
def f():
yield 1
g = f()
with self.assertRaises(TypeError):
copy.copy(g)

@unittest.skipIf(support.stackless, "Stackless can pickle generators")
def test_pickle(self):
def f():
yield 1
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/test_xml_etree.py
Original file line number Diff line number Diff line change
Expand Up @@ -2083,12 +2083,14 @@ def test_iter_by_tag(self):
self.assertEqual(self._ilist(doc), all_tags)
self.assertEqual(self._ilist(doc, '*'), all_tags)

@unittest.skipIf(support.stackless, "Stackless can copy iterators")
def test_copy(self):
a = ET.Element('a')
it = a.iter()
with self.assertRaises(TypeError):
copy.copy(it)

@unittest.skipIf(support.stackless, "Stackless can pickle iterators")
def test_pickle(self):
a = ET.Element('a')
it = a.iter()
Expand Down

0 comments on commit bf6be12

Please sign in to comment.