Commit b8994b25 authored by Chris Ramstad's avatar Chris Ramstad

Modified dict tests

removed dict_contains.py
fixed merge miss in dict.cpp
parent 50eb5bed
......@@ -149,6 +149,7 @@ Box* dictSetdefault(BoxedDict* self, Box* k, Box* v) {
Box* dictContains(BoxedDict* self, Box* k) {
assert(self->cls == dict_cls);
return boxBool(self->d.count(k) != 0);
}
extern "C" Box* dictNew(Box* _cls) {
if (!isSubclass(_cls->cls, type_cls))
......
......@@ -46,3 +46,20 @@ print dict()
d = dict()
d[1] = 2
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
# 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)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment