/usr/lib/python3/dist-packages/twisted/python/test
NameSizeModeActions
__pycache__/-0755rm
deprecatedattributes.py5710644editdlrm
modules_helpers.py16050644editdlrm
pullpipe.py12200644editdlrm
test_appdirs.py10810644editdlrm
test_components.py259740644editdlrm
test_constants.py381170644editdlrm
test_deprecate.py389300644editdlrm
test_dist3.py18580644editdlrm
test_fakepwd.py141070644editdlrm
test_htmlizer.py12660644editdlrm
test_inotify.py36390644editdlrm
test_release.py410460644editdlrm
test_runtime.py79260644editdlrm
test_sendmsg.py252330644editdlrm
test_setup.py124130644editdlrm
test_shellcomp.py218090644editdlrm
test_syslog.py49480644editdlrm
test_systemd.py64010644editdlrm
test_textattributes.py7120644editdlrm
test_tzhelper.py39840644editdlrm
test_url.py299280644editdlrm
test_urlpath.py103280644editdlrm
test_util.py364600644editdlrm
test_versions.py54000644editdlrm
test_zippath.py34740644editdlrm
test_zipstream.py123080644editdlrm
_deprecatetests.py.3only18140644editdlrm
__init__.py420644editdlrm
Edit: /usr/lib/python3/dist-packages/twisted/python/test/_deprecatetests.py.3only (1814B)
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import inspect from twisted.python.deprecate import _passedSignature from twisted.trial.unittest import SynchronousTestCase class KeywordOnlyTests(SynchronousTestCase): """ Keyword only arguments (PEP 3102). """ def checkPassed(self, func, *args, **kw): """ Test an invocation of L{passed} with the given function, arguments, and keyword arguments. @param func: A function whose argspec to pass to L{_passed}. @type func: A callable. @param args: The arguments which could be passed to L{func}. @param kw: The keyword arguments which could be passed to L{func}. @return: L{_passed}'s return value @rtype: L{dict} """ return _passedSignature(inspect.signature(func), args, kw) def test_passedKeywordOnly(self): """ Keyword only arguments follow varargs. They are specified in PEP 3102. """ def func1(*a, b=True): """ b is a keyword-only argument, with a default value. """ def func2(*a, b=True, c, d, e): """ b, c, d, e are keyword-only arguments. b has a default value. """ self.assertEqual(self.checkPassed(func1, 1, 2, 3), dict(a=(1, 2, 3), b=True)) self.assertEqual(self.checkPassed(func1, 1, 2, 3, b=False), dict(a=(1, 2, 3), b=False)) self.assertEqual(self.checkPassed(func2, 1, 2, b=False, c=1, d=2, e=3), dict(a=(1, 2), b=False, c=1, d=2, e=3)) self.assertRaises(TypeError, self.checkPassed, func2, 1, 2, b=False, c=1, d=2)