Commit 3b1fed05 authored by Chris Ramstad's avatar Chris Ramstad

Removed boxStrConstant, uncommented a few tests

parent 277fee03
...@@ -227,19 +227,17 @@ extern "C" Box* tupleNew(Box* _cls, BoxedTuple* args, BoxedDict* kwargs) { ...@@ -227,19 +227,17 @@ extern "C" Box* tupleNew(Box* _cls, BoxedTuple* args, BoxedDict* kwargs) {
elements = args->elts[0]; elements = args->elts[0];
} else { } else {
assert(kwargs_sz); assert(kwargs_sz);
static const BoxedString* seq_str = boxStrConstant("sequence");
auto const seq = *(kwargs->d.begin()); auto const seq = *(kwargs->d.begin());
auto const kw = static_cast<BoxedString*>(seq.first); auto const kw = static_cast<BoxedString*>(seq.first);
if (kw->s == seq_str->s) if (kw->s == "sequence")
elements = seq.second; elements = seq.second;
else else
raiseExcHelper(TypeError, "'%s' is an invalid keyword argument for this function", kw->s.c_str()); raiseExcHelper(TypeError, "'%s' is an invalid keyword argument for this function", kw->s.c_str());
} }
llvm::iterator_range<BoxIterator> range = elements->pyElements(); for (auto e : elements->pyElements())
for (BoxIterator it1 = range.begin(); it1 != range.end(); ++it1) velts.push_back(e);
velts.push_back(*it1);
} }
return new BoxedTuple(std::move(velts)); return new BoxedTuple(std::move(velts));
......
...@@ -89,13 +89,13 @@ print tuple(sequence=(1,3,7,42)) ...@@ -89,13 +89,13 @@ print tuple(sequence=(1,3,7,42))
print tuple(sequence=['i', 42, 'j', 318]) print tuple(sequence=['i', 42, 'j', 318])
print tuple(sequence='hello world') print tuple(sequence='hello world')
print tuple(sequence={'a': 1}) print tuple(sequence={'a': 1})
#print tuple(sequence={1,2,3,4}) print sorted(tuple(sequence={1,2,3,4}))
print tuple((1,3,7,42)) == tuple(sequence=(1,3,7,42)) print tuple((1,3,7,42)) == tuple(sequence=(1,3,7,42))
print tuple(['i', 42, 'j', 318]) == tuple(sequence=['i', 42, 'j', 318]) print tuple(['i', 42, 'j', 318]) == tuple(sequence=['i', 42, 'j', 318])
print tuple('hello world') == tuple(sequence='hello world') print tuple('hello world') == tuple(sequence='hello world')
print tuple({'a': 1}) == tuple(sequence={'a': 1}) print tuple({'a': 1}) == tuple(sequence={'a': 1})
#print tuple({1,2,3,4}) == tuple(sequence={1,2,3,4}) print sorted(tuple({1,2,3,4})) == sorted(tuple(sequence={1,2,3,4}))
# too many arguments # too many arguments
try: try:
......
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