diff options
| author | Benjamin Peterson <benjamin@python.org> | 2016-04-16 21:54:27 (GMT) |
|---|---|---|
| committer | Benjamin Peterson <benjamin@python.org> | 2016-04-16 21:54:27 (GMT) |
| commit | 259d247b3187150f2ea910beda65cbcd5b1a9a95 (patch) | |
| tree | 876c059fa13f3c6e4324c947dd83900fe2cdb430 /Lib/test/test_slice.py | |
| parent | b2871faa874c5a7abd7d9f77dfeb6082253a40be (diff) | |
| parent | 2b601d39058dbcd0881ffaab40eeb4981f431fc8 (diff) | |
| download | cpython-259d247b3187150f2ea910beda65cbcd5b1a9a95.zip cpython-259d247b3187150f2ea910beda65cbcd5b1a9a95.tar.gz cpython-259d247b3187150f2ea910beda65cbcd5b1a9a95.tar.bz2 | |
merge 3.5 (#26659)
Diffstat (limited to 'Lib/test/test_slice.py')
| -rw-r--r-- | Lib/test/test_slice.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Lib/test/test_slice.py b/Lib/test/test_slice.py index 8c4e670..5e76655 100644 --- a/Lib/test/test_slice.py +++ b/Lib/test/test_slice.py @@ -1,11 +1,13 @@ # tests for slice objects; in particular the indices method. -import unittest -from pickle import loads, dumps - import itertools import operator import sys +import unittest +import weakref + +from pickle import loads, dumps +from test import support def evaluate_slice_index(arg): @@ -240,5 +242,14 @@ class SliceTest(unittest.TestCase): self.assertEqual(s.indices(15), t.indices(15)) self.assertNotEqual(id(s), id(t)) + def test_cycle(self): + class myobj(): pass + o = myobj() + o.s = slice(o) + w = weakref.ref(o) + o = None + test_support.gc_collect() + self.assertIsNone(w()) + if __name__ == "__main__": unittest.main() |
