diff --git a/test/test_python_list.py b/test/test_python_list.py index 2072c3e7..bddc8e98 100644 --- a/test/test_python_list.py +++ b/test/test_python_list.py @@ -44,7 +44,7 @@ def run(args = None): if __name__ == '__main__': import test_python_ref_common # Checks for python reference semantics import test_vector_common - __doc__ += test_python_ref_common.common_doctest_string + __doc__ += test_python_ref_common.extended_doctest_string __doc__ += test_vector_common.common_doctest_string print 'running...' import sys diff --git a/test/test_python_ref_common.py b/test/test_python_ref_common.py index 860efb2c..45be4416 100644 --- a/test/test_python_ref_common.py +++ b/test/test_python_ref_common.py @@ -87,16 +87,18 @@ -1 -1 ''' -# It would be nice if sorting the list did not detach any existing -# proxies, but this is probably not possible to guarantee with the -# current implementation. The overload of iter_swap is sufficient with -# some standard libraries, but not others. The following test works -# only on MSVC so far. +# It would be nice if sorting the list did not detach any elements +# from a container_proxy, but this is probably not possible to +# guarantee with the current implementation. The problem is that some +# standard libraries apply operator= to the elements during a sort, +# instead of using the overloaded iter_swap. The following extension +# to the test works with container_proxy on MSVC 7.1 and should work +# everywhere with a container of shared pointers or a real Python list -# -# >>> increment(v[0]) # Mutate value in container -# >>> print least_element, v[0] # Verify proxy still attached -# 0 0 -# +sort_test_extension = \ +'>>> increment(v[0]) # Mutate value in container\n' \ +'>>> print least_element, v[0] # Verify proxy still attached\n' \ +'0 0\n' common_doctest_string = __doc__ +extended_doctest_string = common_doctest_string + sort_test_extension