Fixed error when desc() returns multiple results

This commit is contained in:
2020-12-04 17:37:06 +01:00
parent 8b86998225
commit d364878ddb
16 changed files with 408 additions and 19 deletions
+38
View File
@@ -14,3 +14,41 @@ class TestSheerkaNonRegDisplay(TestUsingMemoryBasedSheerka):
captured = capsys.readouterr()
assert captured.out == "ReturnValue(who=evaluators.OneSuccess, status=True, value=(1001)one)\n"
def test_i_can_display_multiple_concepts_description(self, capsys):
init = [
"def concept foo as 1",
"def concept foo as 2",
]
sheerka = self.init_scenario(init)
capsys.readouterr()
sheerka.enable_process_return_values = True
sheerka.evaluate_user_input("desc(foo)")
captured = capsys.readouterr()
assert captured.out == """id : 1001
name : foo
key : foo
definition: None
type : None
body : 1
where : None
pre : None
post : None
ret : None
vars : []
props : {}
id : 1002
name : foo
key : foo
definition: None
type : None
body : 2
where : None
pre : None
post : None
ret : None
vars : []
props : {}
"""
+13
View File
@@ -1183,6 +1183,19 @@ as:
assert sheerka.get_attr(res[0].body, sheerka.new("size")) == sheerka.new("little")
assert sheerka.get_attr(res[0].body, sheerka.new("adjective")) == sheerka.new("beautiful")
def test_i_can_display_multiple_concepts_using_desc_command(self):
init = [
"def concept foo as 1",
"def concept foo as 2",
]
sheerka = self.init_scenario(init)
res = sheerka.evaluate_user_input("desc(foo)")
assert len(res) == 1
assert res[0].status
assert sheerka.isinstance(res[0].body, BuiltinConcepts.TO_MULTI)
class TestSheerkaNonRegFile(TestUsingFileBasedSheerka):
def test_i_can_def_several_concepts(self):