Coverage for skema/gromet/execution_engine/tests/test_execution_server.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.5.0, created at 2024-04-30 17:15 +0000

1from fastapi.testclient import TestClient 

2 

3from skema.gromet.execution_engine.server import app 

4 

5client = TestClient(app) 

6 

7def test_enrich_amr(): 

8 '''Test case for /amr-enrichment endpoint''' 

9 request = { 

10 "amr": { 

11 "semantics": { 

12 "ode":{ 

13 "parameters":[ 

14 {"name": "a"}, 

15 {"name": "b"}, 

16 {"name": "c"} 

17 ] 

18 } 

19 } 

20 }, 

21 "source": "a=1\nb=a+1\nc=b-a", 

22 "filename": "source.py" 

23 } 

24 

25 response=client.post("/execution-engine/amr-enrichment", json=request) 

26 parameters = response.json()["semantics"]["ode"]["parameters"] 

27 assert parameters == [ 

28 {"name": "a", "value": 1}, 

29 {"name": "b", "value": 2}, 

30 {"name": "c", "value": 1} 

31 ]