Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
eda9e2b6
Commit
eda9e2b6
authored
Dec 08, 2007
by
Christian Heimes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added another test case for kwonly methods
parent
0da5bd6e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
Lib/test/test_keywordonlyarg.py
Lib/test/test_keywordonlyarg.py
+9
-0
Lib/test/test_xmlrpc.py
Lib/test/test_xmlrpc.py
+7
-8
No files found.
Lib/test/test_keywordonlyarg.py
View file @
eda9e2b6
...
...
@@ -151,6 +151,15 @@ class KeywordOnlyArgTestCase(unittest.TestCase):
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
)
...
...
Lib/test/test_xmlrpc.py
View file @
eda9e2b6
...
...
@@ -169,6 +169,13 @@ class FaultTestCase(unittest.TestCase):
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 @@ class SimpleServerTestCase(unittest.TestCase):
# 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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment