Sfoglia il codice sorgente

Further fixes to Python wrapper

Yentl Van Tendeloo 8 anni fa
parent
commit
a432a5b641
2 ha cambiato i file con 10 aggiunte e 9 eliminazioni
  1. 4 3
      wrappers/modelverse.py
  2. 6 6
      wrappers/test_modelverse.py

+ 4 - 3
wrappers/modelverse.py

@@ -306,8 +306,9 @@ def types():
     if mode != 3:
         raise InvalidMode()
     _input("types")
+    _output()
     lst = []
-    while (_output() != "Ready for command..."):
+    while (_output() != "Please give your command."):
         v = _last_output()
         m, mm = v.split(":")
         m.strip()
@@ -331,7 +332,7 @@ def read(ID):
         src = _last_output().split(":")[1].strip()
         trg = _output().split(":")[1].strip()
         rval = (t, (src, trg))
-    while (_output() != "Ready for command..."):
+    while (_output() != "Please give your command."):
         pass
     return rval
 
@@ -346,7 +347,7 @@ def read_attrs(ID):
     rval = {}
     while (_output() != "Attributes:"):
         pass
-    while (_output() != "Ready for command..."):
+    while (_output() != "Please give your command."):
         r = _last_output()
         key, value = r.split(":")
         _, value = value.split("=")

+ 6 - 6
wrappers/test_modelverse.py

@@ -7,11 +7,11 @@ password = str(random())
 init()
 register(username, password)
 
-try:
-    model_add("PetriNets", "SimpleClassDiagrams", open("../models/petrinet_ports.mvc", "r").read())
-except ModelExists:
-    pass
-
+model_add("PetriNets", "SimpleClassDiagrams", open("../models/petrinet_ports.mvc", "r").read())
 model_modify("PetriNets")
 print(element_list())
-print(model_list())
+try:
+    model_list()
+except InvalidMode:
+    print(types())
+    print(read("Place"))