Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/test/test_extcall.py

    r2 r391  
    11# -*- coding: utf-8 -*-
     2
    23"""Doctest for method/function calls.
    34
     
    236237first argument (got int instance instead)
    237238
    238 A PyCFunction that takes only positional parameters shoud allow an
     239A PyCFunction that takes only positional parameters should allow an
    239240empty keyword dictionary to pass without a complaint, but raise a
    240241TypeError if te dictionary is not empty
     
    252253    TypeError: id() takes no keyword arguments
    253254
     255A corner case of keyword dictionary items being deleted during
     256the 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
     274A 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
     283The 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)
    254291"""
    255292
    256293import unittest
     294import sys
    257295from test import test_support
    258296
    259297
    260 class UnicodeKeywordArgsTest(unittest.TestCase):
     298class ExtCallTest(unittest.TestCase):
    261299
    262300    def test_unicode_keywords(self):
     
    275313
    276314def 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)
    280317
    281318if __name__ == '__main__':
Note: See TracChangeset for help on using the changeset viewer.