[Python-3000-checkins] r59434 - python/branches/py3k/Lib/test/test_keywordonlyarg.py python/branches/py3k/Lib/test/test_xmlrpc.py
christian.heimes
python-3000-checkins at python.org
Sat Dec 8 23:32:48 CET 2007
Author: christian.heimes
Date: Sat Dec 8 23:32:47 2007
New Revision: 59434
Modified:
python/branches/py3k/Lib/test/test_keywordonlyarg.py
python/branches/py3k/Lib/test/test_xmlrpc.py
Log:
Added another test case for kwonly methods
Modified: python/branches/py3k/Lib/test/test_keywordonlyarg.py
==============================================================================
--- python/branches/py3k/Lib/test/test_keywordonlyarg.py (original)
+++ python/branches/py3k/Lib/test/test_keywordonlyarg.py Sat Dec 8 23:32:47 2007
@@ -151,6 +151,15 @@
self.assertEqual(f(), {})
self.assertEqual(f(k1=1, k2=2), {'k1' : 1, 'k2' : 2})
+ def test_kwonly_methods(self):
+ class Example:
+ def f(self, *, k1=1, k2=2):
+ return k1, k2
+
+ self.assertEqual(Example().f(k1=1, k2=2), (1, 2))
+ self.assertEqual(Example.f(Example(), k1=1, k2=2), (1, 2))
+ self.assertRaises(TypeError, Example.f, k1=1, k2=2)
+
def test_main():
run_unittest(KeywordOnlyArgTestCase)
Modified: python/branches/py3k/Lib/test/test_xmlrpc.py
==============================================================================
--- python/branches/py3k/Lib/test/test_xmlrpc.py (original)
+++ python/branches/py3k/Lib/test/test_xmlrpc.py Sat Dec 8 23:32:47 2007
@@ -169,6 +169,13 @@
s = xmlrpclib.Marshaller().dumps(f)
self.assertRaises(xmlrpclib.Fault, xmlrpclib.loads, s)
+ def test_dotted_attribute(self):
+ # this will raise AttirebuteError because code don't want us to use
+ # private methods
+ self.assertRaises(AttributeError,
+ SimpleXMLRPCServer.resolve_dotted_attribute, str, '__add')
+
+ self.assert_(SimpleXMLRPCServer.resolve_dotted_attribute(str, 'title'))
class DateTimeTestCase(unittest.TestCase):
def test_default(self):
@@ -432,14 +439,6 @@
# protocol error; provide additional information in test output
self.fail("%s\n%s" % (e, e.headers))
- def test_dotted_attribute(self):
- # this will raise AttirebuteError because code don't want us to use
- # private methods
- self.assertRaises(AttributeError,
- SimpleXMLRPCServer.resolve_dotted_attribute, str, '__add')
-
- self.assert_(SimpleXMLRPCServer.resolve_dotted_attribute(str, 'title'))
-
# This is a contrived way to make a failure occur on the server side
# in order to test the _send_traceback_header flag on the server
class FailingMessageClass(mimetools.Message):
More information about the Python-3000-checkins
mailing list