[pygccxml-commit] SF.net SVN: pygccxml: [595] pyplusplus_dev
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2006-09-26 20:34:46
|
Revision: 595 http://svn.sourceforge.net/pygccxml/?rev=595&view=rev Author: roman_yakovenko Date: 2006-09-26 13:34:29 -0700 (Tue, 26 Sep 2006) Log Message: ----------- fixing bug in property_t code creator updating unit tests Modified Paths: -------------- pyplusplus_dev/pyplusplus/code_creators/properties.py pyplusplus_dev/unittests/casting_tester.py pyplusplus_dev/unittests/data/operators_bug_to_be_exported.hpp pyplusplus_dev/unittests/impl_conv/sconstruct pyplusplus_dev/unittests/impl_conv/test.py pyplusplus_dev/unittests/operators_bug_tester.py pyplusplus_dev/unittests/properties_tester.py Modified: pyplusplus_dev/pyplusplus/code_creators/properties.py =================================================================== --- pyplusplus_dev/pyplusplus/code_creators/properties.py 2006-09-26 18:56:36 UTC (rev 594) +++ pyplusplus_dev/pyplusplus/code_creators/properties.py 2006-09-26 20:34:29 UTC (rev 595) @@ -53,7 +53,7 @@ pd = self.property_def if pd.fget.call_policies and not pd.fget.call_policies.is_default(): return True - elif pd.fset or pd.fset.call_policies or not pd.fset.call_policies.is_default(): + elif pd.fset or ( pd.fset and ( pd.fset.call_policies or not pd.fset.call_policies.is_default() ) ): return True elif pd.doc: return True Modified: pyplusplus_dev/unittests/casting_tester.py =================================================================== --- pyplusplus_dev/unittests/casting_tester.py 2006-09-26 18:56:36 UTC (rev 594) +++ pyplusplus_dev/unittests/casting_tester.py 2006-09-26 20:34:29 UTC (rev 595) @@ -26,11 +26,7 @@ self.failUnless( 25 == module.x_value(25) ) self.failUnless( 1 == module.x_value(True) ) self.failUnless( 0 == module.x_value(False) ) - try: - fv = module.float_vector( 5.0 ) - self.fail( "TypeError exception was not raised" ) - except TypeError: - pass + fv = module.float_vector( 5.0 ) def create_suite(): suite = unittest.TestSuite() Modified: pyplusplus_dev/unittests/data/operators_bug_to_be_exported.hpp =================================================================== --- pyplusplus_dev/unittests/data/operators_bug_to_be_exported.hpp 2006-09-26 18:56:36 UTC (rev 594) +++ pyplusplus_dev/unittests/data/operators_bug_to_be_exported.hpp 2006-09-26 20:34:29 UTC (rev 595) @@ -1,40 +1,52 @@ -// Copyright 2004 Roman Yakovenko. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef __operators_bug_to_be_exported_hpp__ -#define __operators_bug_to_be_exported_hpp__ - -namespace operators_bug{ - -template< typename derived_type, typename value_type > -struct number{ - - value_type value; - - friend derived_type operator+( const derived_type& y, const derived_type& x ){ - derived_type tmp; - tmp.value = y.value + x.value; - return tmp; - } -protected: - bool operator==( const derived_type& other ){ return value == other.value; } -}; - -struct integral : public number< integral, int >{ - integral operator+( int x ){ - integral tmp; - tmp.value = value + x; - return tmp; - } -}; - -struct integral2 : public number< integral, int >{ - //in this case no operator should be redefined -}; - -} - - -#endif//__operators_bug_to_be_exported_hpp__ +// Copyright 2004 Roman Yakovenko. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef __operators_bug_to_be_exported_hpp__ +#define __operators_bug_to_be_exported_hpp__ + +namespace operators_bug{ + +template< typename derived_type, typename value_type > +struct number{ + + value_type value; + + friend derived_type operator+( const derived_type& y, const derived_type& x ){ + derived_type tmp; + tmp.value = y.value + x.value; + return tmp; + } +protected: + bool operator==( const derived_type& other ){ return value == other.value; } +}; + +struct integral : public number< integral, int >{ + integral operator+( int x ){ + integral tmp; + tmp.value = value + x; + return tmp; + } +}; + +struct integral2 : public number< integral, int >{ + //in this case no operator should be redefined +}; + +struct vector +{ + double x; + static const vector one; + + vector(double ax) : x(ax) {} + vector operator+(const vector& other) const { return vector(x+other.x); } + + virtual void trigger_wrapper() {} +}; + + +} + + +#endif//__operators_bug_to_be_exported_hpp__ \ No newline at end of file Modified: pyplusplus_dev/unittests/impl_conv/sconstruct =================================================================== --- pyplusplus_dev/unittests/impl_conv/sconstruct 2006-09-26 18:56:36 UTC (rev 594) +++ pyplusplus_dev/unittests/impl_conv/sconstruct 2006-09-26 20:34:29 UTC (rev 595) @@ -1,5 +1,5 @@ -SharedLibrary( target=r'ic_ext' - , source=[ r'ic.cpp' ] +SharedLibrary( target=r'operators_ext' + , source=[ r'operators_ext.cpp' ] , LIBS=[ r"boost_python" ] , LIBPATH=[ r"/home/roman/boost_cvs/bin",r"" ] , CPPPATH=[ r"/home/roman/boost_cvs",r"/usr/include/python2.4" ] Modified: pyplusplus_dev/unittests/impl_conv/test.py =================================================================== --- pyplusplus_dev/unittests/impl_conv/test.py 2006-09-26 18:56:36 UTC (rev 594) +++ pyplusplus_dev/unittests/impl_conv/test.py 2006-09-26 20:34:29 UTC (rev 595) @@ -1,3 +1,11 @@ -import ic_ext +import operators_ext -ic_ext.float_vector( 5.0 ) +print 'envoke operator+ using old Boost.Python interface' +old = operators_ext.vector_old() +tmp = old + operators_ext.vector_old.v_old +print 'It works.' + +print 'envoke operator+ using new Boost.Python interface' +new = operators_ext.vector_new() +tmp = new + operators_ext.vector_new.v_new +print 'If you see this message than the bug was fixed. Thank you.' Modified: pyplusplus_dev/unittests/operators_bug_tester.py =================================================================== --- pyplusplus_dev/unittests/operators_bug_tester.py 2006-09-26 18:56:36 UTC (rev 594) +++ pyplusplus_dev/unittests/operators_bug_tester.py 2006-09-26 20:34:29 UTC (rev 595) @@ -22,7 +22,7 @@ mb.classes().redefine_operators = True mb.add_declaration_code( 'const operators_bug::vector operators_bug::vector::one(1);' ) tg = code_creators.target_configuration_t( ) - tg.boost_python_has_wrapper_held_type = False + #tg.boost_python_has_wrapper_held_type = False mb.build_code_creator( self.EXTENSION_NAME, target_configuration=tg ) def run_tests(self, module): Modified: pyplusplus_dev/unittests/properties_tester.py =================================================================== --- pyplusplus_dev/unittests/properties_tester.py 2006-09-26 18:56:36 UTC (rev 594) +++ pyplusplus_dev/unittests/properties_tester.py 2006-09-26 20:34:29 UTC (rev 595) @@ -25,7 +25,8 @@ count.exclude() set_count.exclude() cls.add_property( "count", count, set_count ) - + cls.add_property( "count_ro", count ) + get_nested = cls.member_function( 'get_nested' ) get_nested.call_policies = call_policies.return_internal_reference() set_nested = cls.member_function( 'set_nested' ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |