55from acidwatch_api .app import fastapi_app
66from acidwatch_api .authentication import authenticated_user_claims
77from acidwatch_api .models import base
8+ from acidwatch_api .models .datamodel import Phase
89from acidwatch_api .routes .models import get_adapters
910
1011
@@ -38,7 +39,13 @@ class HalvingAdapter(base.BaseAdapter):
3839 valid_substances = ["H2O" ]
3940
4041 async def run (self ):
41- return {key : value / 2 for key , value in self .concentrations .items ()}
42+ return [
43+ Phase (
44+ kind = "co2-rich" ,
45+ fraction = 1.0 ,
46+ concentrations = {key : value / 2 for key , value in self .concentrations .items ()},
47+ )
48+ ]
4249
4350
4451class QuadruplingAdapter (base .BaseAdapter ):
@@ -49,7 +56,13 @@ class QuadruplingAdapter(base.BaseAdapter):
4956 valid_substances = ["H2O" ]
5057
5158 async def run (self ):
52- return {key : value * 4 for key , value in self .concentrations .items ()}
59+ return [
60+ Phase (
61+ kind = "co2-rich" ,
62+ fraction = 1.0 ,
63+ concentrations = {key : value * 4 for key , value in self .concentrations .items ()},
64+ )
65+ ]
5366
5467
5568class FailingAdapter (base .BaseAdapter ):
@@ -117,7 +130,13 @@ def test_sweep_points_are_individually_retrievable_simulations(client):
117130
118131 assert simulation ["status" ] == "done"
119132 assert simulation ["input" ]["concentrations" ] == {"H2O" : point ["value" ]}
120- assert simulation ["results" ][- 1 ]["concentrations" ] == point ["concentrations" ]
133+ last_result_concentrations = {
134+ k : v
135+ for phase in simulation ["results" ][- 1 ]["phases" ]
136+ if phase ["kind" ] == "co2-rich"
137+ for k , v in phase ["concentrations" ].items ()
138+ }
139+ assert last_result_concentrations == point ["concentrations" ]
121140
122141
123142@pytest .mark .usefixtures ("dummy_adapters" )
0 commit comments