@@ -769,3 +769,53 @@ def test_wrong_overload():
769769 res = System .Math .Max (System .Double (50.5 ), 50.1 )
770770 assert res == 50.5
771771 assert type (res ) == float
772+
773+
774+ def test_no_object_in_param ():
775+ """Test that fix for #203 doesn't break behavior w/ no object overload"""
776+
777+ res = MethodTest .TestOverloadedNoObject (5 )
778+ assert res == "Got int"
779+
780+ with pytest .raises (TypeError ):
781+ MethodTest .TestOverloadedNoObject ("test" )
782+
783+
784+ def test_object_in_param ():
785+ """Test regression introduced by #151 in which Object method overloads
786+ aren't being used. See #203 for issue."""
787+
788+ res = MethodTest .TestOverloadedObject (5 )
789+ assert res == "Got int"
790+
791+ res = MethodTest .TestOverloadedObject ("test" )
792+ assert res == "Got object"
793+
794+
795+ def test_object_in_multiparam ():
796+ """Test method with object multiparams behaves"""
797+
798+ res = MethodTest .TestOverloadedObjectTwo (5 , 5 )
799+ assert res == "Got int-int"
800+
801+ res = MethodTest .TestOverloadedObjectTwo (5 , "foo" )
802+ assert res == "Got int-string"
803+
804+ res = MethodTest .TestOverloadedObjectTwo ("foo" , 7.24 )
805+ assert res == "Got string-object"
806+
807+ res = MethodTest .TestOverloadedObjectTwo ("foo" , "bar" )
808+ assert res == "Got string-string"
809+
810+ res = MethodTest .TestOverloadedObjectTwo ("foo" , 5 )
811+ assert res == "Got string-int"
812+
813+ res = MethodTest .TestOverloadedObjectTwo (7.24 , 7.24 )
814+ assert res == "Got object-object"
815+
816+
817+ def test_object_in_multiparam_exception ():
818+ """Test method with object multiparams behaves"""
819+
820+ with pytest .raises (TypeError ):
821+ MethodTest .TestOverloadedObjectThree ("foo" , "bar" )
0 commit comments