Skip to content

Bug when return iterable with one element #10

@artzet-s

Description

@artzet-s

Hi, I encounter problem :

def test_bug_0():  
    return {"A": 0, "B": 1}

def test_bug_1():
    return {"A": 0, "B": 1, "C": 2}

def test_bug_2():
    return {"A": {0: 42, 1: 21}, "B": 1, "C": 2}

def test_bug_3():
    return {"A": {0: 42, 1: 21}}

def test_bug_4():
    return {"A": {0: 42}, "B": {1: 21}}

test_bug_3() bug and return :

Traceback (most recent call last):
  File "c:\users\artzetsi\miniconda2\envs\develop\lib\site-packages\openalea.core-2.0.2-py2.7.egg\openalea\core\algo\dataflow_evaluation.py", line 227, in eval_vertex_code
    ret = node.eval()
  File "c:\users\artzetsi\miniconda2\envs\develop\lib\site-packages\openalea.core-2.0.2-py2.7.egg\openalea\core\node.py", line 654, in eval
    self.outputs[0] = outlist[0]
KeyError: 0

Worst with a collection.defaultdict like :

def test_bug_5():
    d = collections.defaultdict(dict)
    d["A"][0] = 42
    return d

don't throw error; just return a empty dict {}

Same for you ?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions