def test_arg_boolean_overload(self): ''' TODO: In addition to test_arg_boolean_overload, we need to split up test_arg_Boolean into two more functions as well - test_arg_boolean_overload_typeerror and test_arg_boolean_overload_overflowerror. This should be done for all of these types of tests to make them more readable and maintainable. ''' from IronPythonTest.BinderTest import COverloads_Boolean, Flag o = COverloads_Boolean() param_method_map = { None : [ o.M100, o.M101, o.M102, o.M103, o.M104, o.M105, o.M106, o.M107, o.M108, o.M109, o.M110, o.M111], True : [ o.M100, o.M101, o.M102, o.M103, o.M104, o.M105, o.M106, o.M107, o.M108, o.M109, o.M110, o.M111, o.M112], False : [ o.M100, o.M101, o.M102, o.M103, o.M104, o.M105, o.M106, o.M107, o.M108, o.M109, o.M110, o.M111, o.M112], 100 : [ o.M100], myint(100): [ o.M100], -100 : [ o.M100], UInt32Max: [ o.M100, o.M106], 200L : [ o.M100, o.M106, o.M109], -200L : [ o.M100, o.M106, o.M109], Byte10 : [ o.M100], SBytem10 : [ o.M100], Int1610 : [ o.M100], Int16m20 : [ o.M100], 12.34 : [ o.M100, o.M101, o.M102, o.M103, o.M104, o.M105, o.M106, o.M107, o.M108, o.M109, o.M110], } for param in param_method_map.keys(): for meth in param_method_map[param]: expected_flag = int(meth.__name__[1:]) meth(param) self.assertEqual(expected_flag, Flag.Value)
def test_arg_Double(self): from IronPythonTest.BinderTest import COverloads_Double target = COverloads_Double() for (arg, mapping, funcTypeError, funcOverflowError) in [ ( None, _merge(_first(''), _second('M100 M112 ')), 'M101 M102 M103 M104 M105 M106 M107 M108 M109 M110 M111 ', '', ), ( True, _merge(_first('M101 M102 M103 M104 M105 M106 M108 M112 '), _second('M100 M107 M109 M111 ')), 'M110 ', '', ), ( False, _merge(_first('M101 M102 M103 M104 M105 M106 M108 M112 '), _second('M100 M107 M109 M111 ')), 'M110 ', '', ), ( 100, _merge(_first('M100 M101 M102 M103 M104 M105 M106 M108 M112 '), _second('M107 M109 M111 ')), 'M110 ', '', ), ( myint(100), _merge(_first('M100 M101 M102 M103 M104 M105 M106 M108 M112 '), _second('M107 M109 M111 ')), 'M110 ', '', ), ( -100, _merge(_first('M100 M101 M102 M103 M104 M105 M106 M108 M112 '), _second('M107 M109 M111 ')), 'M110 ', '', ), ( UInt32Max, _merge(_first('M100 M101 M102 M103 M104 M105 M107 M112 '), _second('M106 M108 M109 M111 ')), 'M110 ', '', ), ( 200L, _merge(_first('M101 M100 M102 M103 M104 M105 M106 M107 M108 M109 M110 M112 '), _second('M111 ')), '', '', ), ( -200L, _merge(_first('M101 M100 M102 M103 M104 M105 M106 M107 M108 M109 M110 M112 '), _second('M111 ')), '', '', ), ( Byte10, _merge(_first('M100 M101 M103 M112 '), _second('M102 M104 M105 M106 M107 M108 M109 M111 ')), 'M110 ', '', ), ( SBytem10, _merge(_first('M100 M101 M102 M104 M106 M108 M112 '), _second('M103 M105 M107 M109 M111 ')), 'M110 ', '', ), ( Int1610, _merge(_first('M100 M101 M102 M103 M104 M106 M108 M112 '), _second('M105 M107 M109 M111 ')), 'M110 ', '', ), ( Int16m20, _merge(_first('M100 M101 M102 M103 M104 M106 M108 M112 '), _second('M105 M107 M109 M111 ')), 'M110 ', '', ), ( 12.34, _first('M100 M101 M102 M103 M104 M105 M106 M107 M108 M109 M110 M111 M112 '), '', '', ), ]: self._try_arg(target, arg, mapping, funcTypeError, funcOverflowError)