diff options
Diffstat (limited to 'Lib/test/test_call.py')
-rw-r--r-- | Lib/test/test_call.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_call.py b/Lib/test/test_call.py index 2e8819b..e71ede2 100644 --- a/Lib/test/test_call.py +++ b/Lib/test/test_call.py @@ -1,3 +1,4 @@ +import collections import datetime import unittest from test.support import cpython_only @@ -6,6 +7,23 @@ try: except ImportError: _testcapi = None + +class FunctionCalls(unittest.TestCase): + + def test_kwargs_order(self): + # bpo-34320: **kwargs should preserve order of passed OrderedDict + od = collections.OrderedDict([('a', 1), ('b', 2)]) + od.move_to_end('a') + expected = list(od.items()) + + def fn(**kw): + return kw + + res = fn(**od) + self.assertIsInstance(res, dict) + self.assertEqual(list(res.items()), expected) + + # The test cases here cover several paths through the function calling # code. They depend on the METH_XXX flag that is used to define a C # function, which can't be verified from Python. If the METH_XXX decl |