Changeset 391 for python/trunk/Lib/test/test_extcall.py
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Lib/test/test_extcall.py
r2 r391 1 1 # -*- coding: utf-8 -*- 2 2 3 """Doctest for method/function calls. 3 4 … … 236 237 first argument (got int instance instead) 237 238 238 A PyCFunction that takes only positional parameters shou d allow an239 A PyCFunction that takes only positional parameters should allow an 239 240 empty keyword dictionary to pass without a complaint, but raise a 240 241 TypeError if te dictionary is not empty … … 252 253 TypeError: id() takes no keyword arguments 253 254 255 A corner case of keyword dictionary items being deleted during 256 the function call setup. See <http://bugs.python.org/issue2016>. 257 258 >>> class Name(str): 259 ... def __eq__(self, other): 260 ... try: 261 ... del x[self] 262 ... except KeyError: 263 ... pass 264 ... return str.__eq__(self, other) 265 ... def __hash__(self): 266 ... return str.__hash__(self) 267 268 >>> x = {Name("a"):1, Name("b"):2} 269 >>> def f(a, b): 270 ... print a,b 271 >>> f(**x) 272 1 2 273 274 A obscure message: 275 276 >>> def f(a, b): 277 ... pass 278 >>> f(b=1) 279 Traceback (most recent call last): 280 ... 281 TypeError: f() takes exactly 2 arguments (1 given) 282 283 The number of arguments passed in includes keywords: 284 285 >>> def f(a): 286 ... pass 287 >>> f(6, a=4, *(1, 2, 3)) 288 Traceback (most recent call last): 289 ... 290 TypeError: f() takes exactly 1 argument (5 given) 254 291 """ 255 292 256 293 import unittest 294 import sys 257 295 from test import test_support 258 296 259 297 260 class UnicodeKeywordArgsTest(unittest.TestCase):298 class ExtCallTest(unittest.TestCase): 261 299 262 300 def test_unicode_keywords(self): … … 275 313 276 314 def test_main(): 277 from test import test_extcall # self import 278 test_support.run_doctest(test_extcall, True) 279 test_support.run_unittest(UnicodeKeywordArgsTest) 315 test_support.run_doctest(sys.modules[__name__], True) 316 test_support.run_unittest(ExtCallTest) 280 317 281 318 if __name__ == '__main__':
Note:
See TracChangeset
for help on using the changeset viewer.