Commit 7bec7671 authored by Xavier Thompson's avatar Xavier Thompson

Add unit test for cypclass list iterators increasing list refcount

parent aa4bbb61
...@@ -102,7 +102,6 @@ def test_contains(): ...@@ -102,7 +102,6 @@ def test_contains():
if value not in l: if value not in l:
return 0 return 0
return 1 return 1
def test_getitem_out_of_range(): def test_getitem_out_of_range():
""" """
...@@ -303,3 +302,38 @@ def test_values_refcount(): ...@@ -303,3 +302,38 @@ def test_values_refcount():
if Cy_GETREF(value) != 2: if Cy_GETREF(value) != 2:
return 0 return 0
return 1 return 1
def test_iterator_refcount():
"""
>>> test_iterator_refcount()
1
"""
l = cyplist[Value]()
if Cy_GETREF(l) != 2:
return 0
def begin_iterator():
it = l.begin()
if Cy_GETREF(l) != 3:
return 0
return 1
if not begin_iterator():
return 0
if Cy_GETREF(l) != 2:
return 0
def end_iterator():
it = l.end()
if Cy_GETREF(l) != 2:
return 0
return 1
if not end_iterator():
return 0
if Cy_GETREF(l) != 2:
return 0
return 1
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment