Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
9e951498
Commit
9e951498
authored
11 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
tests: Add more tests for default keyword-only args.
parent
049a7a81
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/basics/fun-kwonly.py
+0
-9
0 additions, 9 deletions
tests/basics/fun-kwonly.py
tests/basics/fun-kwonlydef.py
+36
-0
36 additions, 0 deletions
tests/basics/fun-kwonlydef.py
with
36 additions
and
9 deletions
tests/basics/fun-kwonly.py
+
0
−
9
View file @
9e951498
...
@@ -43,15 +43,6 @@ def f(a, *, b, **kw):
...
@@ -43,15 +43,6 @@ def f(a, *, b, **kw):
f
(
1
,
b
=
2
)
f
(
1
,
b
=
2
)
f
(
1
,
b
=
2
,
c
=
3
)
f
(
1
,
b
=
2
,
c
=
3
)
# with a default value
def
g
(
a
,
*
,
b
=
2
,
c
):
print
(
a
,
b
,
c
)
g
(
1
,
c
=
3
)
g
(
1
,
b
=
3
,
c
=
4
)
g
(
1
,
**
{
'
c
'
:
3
})
g
(
1
,
**
{
'
b
'
:
'
3
'
,
'
c
'
:
4
})
# with named star
# with named star
def
f
(
*
a
,
b
,
c
):
def
f
(
*
a
,
b
,
c
):
print
(
a
,
b
,
c
)
print
(
a
,
b
,
c
)
...
...
This diff is collapsed.
Click to expand it.
tests/basics/fun-kwonlydef.py
0 → 100644
+
36
−
0
View file @
9e951498
# test function args, keyword only with default value
# a single arg with a default
def
f1
(
*
,
a
=
1
):
print
(
a
)
f1
()
f1
(
a
=
2
)
# 1 arg default, 1 not
def
f2
(
*
,
a
=
1
,
b
):
print
(
a
,
b
)
f2
(
b
=
2
)
f2
(
a
=
2
,
b
=
3
)
# 1 positional, 1 arg default, 1 not
def
f3
(
a
,
*
,
b
=
2
,
c
):
print
(
a
,
b
,
c
)
f3
(
1
,
c
=
3
)
f3
(
1
,
b
=
3
,
c
=
4
)
f3
(
1
,
**
{
'
c
'
:
3
})
f3
(
1
,
**
{
'
b
'
:
'
3
'
,
'
c
'
:
4
})
# many args, not all with defaults
def
f4
(
*
,
a
=
1
,
b
,
c
=
3
,
d
,
e
=
5
,
f
):
print
(
a
,
b
,
c
,
d
,
e
,
f
)
f4
(
b
=
2
,
d
=
4
,
f
=
6
)
f4
(
a
=
11
,
b
=
2
,
d
=
4
,
f
=
6
)
f4
(
a
=
11
,
b
=
2
,
c
=
33
,
d
=
4
,
e
=
55
,
f
=
6
)
f4
(
f
=
6
,
e
=
55
,
d
=
4
,
c
=
33
,
b
=
2
,
a
=
11
)
# positional with default, then keyword only
def
f5
(
a
,
b
=
4
,
*
c
,
d
=
8
):
print
(
a
,
b
,
c
,
d
)
f5
(
1
)
f5
(
1
,
d
=
9
)
f5
(
1
,
b
=
44
,
d
=
9
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment