PageRenderTime 57ms CodeModel.GetById 8ms RepoModel.GetById 0ms app.codeStats 0ms

/IronPython_Main/Languages/IronPython/Tests/interop/net/method/__init__.py

#
Python | 137 lines | 84 code | 1 blank | 52 comment | 0 complexity | ed68794c909d112f52fc32373e0a7bbb MD5 | raw file
Possible License(s): GPL-2.0, MPL-2.0-no-copyleft-exception, CPL-1.0, CC-BY-SA-3.0, BSD-3-Clause, ISC, AGPL-3.0, LGPL-2.1, Apache-2.0
  1. #####################################################################################
  2. #
  3. # Copyright (c) Microsoft Corporation. All rights reserved.
  4. #
  5. # This source code is subject to terms and conditions of the Apache License, Version 2.0. A
  6. # copy of the license can be found in the License.html file at the root of this distribution. If
  7. # you cannot locate the Apache License, Version 2.0, please send an email to
  8. # ironpy@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
  9. # by the terms of the Apache License, Version 2.0.
  10. #
  11. # You must not remove this notice, or any other, from this software.
  12. #
  13. #
  14. #####################################################################################
  15. '''
  16. General
  17. * Where it is defined
  18. * How it is defined
  19. - Static and instance
  20. - Explicit interface method implementation
  21. - Virtual, new, override
  22. Passing arguments with different parameter lists
  23. In C#,
  24. public void M1(int x, int y) { }
  25. public void M2(int x, params int[] y)
  26. public void M3(int x, [DefaultParameterValue(5)] int y)
  27. public void M6([Optional] int x, [Optional] object y)
  28. public void M7([Out] int x)
  29. public void M7([ParamsDictionary] IattributesCollection dict)
  30. * Methods with
  31. - one of such special parameter,
  32. - two of such special parameters
  33. - one normal, the other special parameter. And different orders.
  34. - 3+ parameters with mixed kind
  35. * Where DefaultParameterValue/Optional Attributes are not the last parameters.
  36. * Different parameter types - string, int, Boolean, Object, self-defined
  37. struct, class, variables.
  38. * Check optional (missing) value
  39. * Argument name are language special:
  40. - (python) True, def
  41. * Params as an intermediate parameter (only via params setter? Or also via
  42. IL or direct attr?)
  43. (Python)
  44. * try with different parameter lists:
  45. - positional argument,
  46. - keyword argument,
  47. - *tuple style,
  48. - *dictionary style,
  49. - Mixed of them.
  50. * Argument for the default value parameter (provide, not provide...)
  51. * Negative scenarios
  52. - "params" could not be "keyword" argument?
  53. - Provide parameter more than once (such as positional, and keyword...)
  54. Passing arguments for By-ref parameters
  55. In C#,
  56. public void M1(int x, ref int y) { ... }
  57. public void M2(int x, out int y) { ... }
  58. * Methods with
  59. - Similar aspect as the previous scenario
  60. - Consider mixing with default value/ params arguments
  61. - Ref, out parameters are not at last.
  62. * Same for constructor.
  63. (Python)
  64. * call each of them with different parameter lists (similar to previous matrix)
  65. * pay attention to:
  66. - clr.Reference
  67. - Whether you need pass argument
  68. - What kind of argument
  69. - Mix&match is not supported
  70. * Negative scenarios.
  71. Method Overloads
  72. * Related to method signatures
  73. * Related to argument values/types
  74. * (python?) Related to return values (specifically conversions on returns,
  75. nullable types, etc...)
  76. * Methods with different parameters
  77. * Non-generic / generic methods have the same name
  78. - Activator.CreateInstance scenario
  79. - G<T>.M(int), G<T>.M(T)
  80. - G.M(int), G.M<T>(T)
  81. * Static method and instance method have the same name
  82. - instance M(C), static M(thisType, C)
  83. * Same name as explicit interface method
  84. Operator Overloading
  85. * all supported overloads (well-behavior)
  86. - http://msdn2.microsoft.com/en-us/library/2sk3x8a7(vs.71).aspx
  87. * unary/binary overloads (not defined as usual)
  88. - positive
  89. * instance method
  90. * static method where the first parameter is not the declaring type
  91. * has CodeContext as the first argument
  92. - negative
  93. * unary operator has 0, 2, 3 parameter
  94. * binary operator has 0, 1, 3 parameters
  95. * Call the operator explicitly
  96. * Provide one-side comparison operator overload, but access the reverse-side
  97. operator
  98. * Provide simple operator overload, but call in-place operator
  99. * Overloads
  100. * Value type which has operator overloads
  101. * Something Python is unable to practice:
  102. - op_Assign, ...
  103. * Something decorated with special attribute (GetItem, GetBoundMember...)
  104. (Python)
  105. * __xxx__ call style
  106. User-defined conversions
  107. * TODO
  108. Implicit conversion operator
  109. * Where it is applied: only passing as argument to method
  110. * Where it is defined:
  111. - Value type, reference type, generics
  112. * How it is defined:
  113. - Instance op_Implicit method
  114. - Overload scenario
  115. * (python) Implicit vs. Explicit: when do we use what
  116. * C#: http://msdn2.microsoft.com/en-us/library/aa691280(VS.71).aspx
  117. - Implicit enumeration conversions
  118. - Implicit reference conversions
  119. - Boxing conversions
  120. * Check the pass-in value/identity?
  121. - User-defined implicit conversions
  122. * Builtin number/char/string/bool/enum -> class/struct
  123. * Class/struct -> class/struct
  124. * Generic types (G<T>, G<int>, GOfInt, G<K, V>)
  125. * Conversion among base/derived types
  126. Explicit conversion operator
  127. * Not supported by the language yet, tracking as bug 314284
  128. * (python) __int__, __long__, __float__, __complex__, __nonzero__
  129. '''