Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Boxiang Sun
Pyston
Commits
b8994b25
Commit
b8994b25
authored
Jul 31, 2014
by
Chris Ramstad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified dict tests
removed dict_contains.py fixed merge miss in dict.cpp
parent
50eb5bed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
11 deletions
+18
-11
src/runtime/dict.cpp
src/runtime/dict.cpp
+1
-0
test/tests/dict.py
test/tests/dict.py
+17
-0
test/tests/dict_contains.py
test/tests/dict_contains.py
+0
-11
No files found.
src/runtime/dict.cpp
View file @
b8994b25
...
@@ -149,6 +149,7 @@ Box* dictSetdefault(BoxedDict* self, Box* k, Box* v) {
...
@@ -149,6 +149,7 @@ Box* dictSetdefault(BoxedDict* self, Box* k, Box* v) {
Box
*
dictContains
(
BoxedDict
*
self
,
Box
*
k
)
{
Box
*
dictContains
(
BoxedDict
*
self
,
Box
*
k
)
{
assert
(
self
->
cls
==
dict_cls
);
assert
(
self
->
cls
==
dict_cls
);
return
boxBool
(
self
->
d
.
count
(
k
)
!=
0
);
return
boxBool
(
self
->
d
.
count
(
k
)
!=
0
);
}
extern
"C"
Box
*
dictNew
(
Box
*
_cls
)
{
extern
"C"
Box
*
dictNew
(
Box
*
_cls
)
{
if
(
!
isSubclass
(
_cls
->
cls
,
type_cls
))
if
(
!
isSubclass
(
_cls
->
cls
,
type_cls
))
...
...
test/tests/dict.py
View file @
b8994b25
...
@@ -46,3 +46,20 @@ print dict()
...
@@ -46,3 +46,20 @@ print dict()
d
=
dict
()
d
=
dict
()
d
[
1
]
=
2
d
[
1
]
=
2
print
d
print
d
print
1
in
{}
print
1
in
{
1
:
1
}
print
'a'
in
{}
print
'a'
in
{
'a'
:
1
}
print
'a'
in
dict
()
try
:
# attempting to print the following result causes the test
# to fail (bad output), but runtime is ok. otherwise it
# throws a TypeError exception.
# print 'a' in dict(a=1)
'a'
in
dict
(
a
=
1
)
except
TypeError
,
e
:
# throws <function ...> doesn't take keyword arguments
pass
print
d
test/tests/dict_contains.py
deleted
100644 → 0
View file @
50eb5bed
# expected: fail
# using {} style works
print
1
in
{}
print
1
in
{
1
:
1
}
print
'a'
in
{}
print
'a'
in
{
'a'
:
1
}
# using dict fails
print
'a'
in
dict
()
print
'a'
in
dict
(
a
=
1
)
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