55from epanet .output import OutputMetadata
66from epanet .output import output as oapi
77
8+ from data import OUTPUT_FILE_EXAMPLE1
89
9- def test_outputmetadata ():
10- om = OutputMetadata (None )
10+
11+ def test_outputmetadata_handle ():
12+
13+ ref = {
14+ oapi .NodeAttribute .DEMAND : ("Demand" , "gal/min" ),
15+ oapi .NodeAttribute .HEAD : ("Head" , "ft" ),
16+ oapi .NodeAttribute .PRESSURE : ("Pressure" , "psi" ),
17+ oapi .NodeAttribute .QUALITY : ("Quality" , "mg/L" ),
18+
19+ oapi .LinkAttribute .FLOW : ("Flow" , "gal/min" ),
20+ oapi .LinkAttribute .VELOCITY : ("Velocity" , "ft/sec" ),
21+ oapi .LinkAttribute .HEADLOSS : ("Unit Headloss" , "ft/1000ft" ),
22+ oapi .LinkAttribute .AVG_QUALITY : ("Quality" , "mg/L" ),
23+ oapi .LinkAttribute .STATUS : ("Status" , "" ),
24+ oapi .LinkAttribute .SETTING : ("Setting" , "" ),
25+ oapi .LinkAttribute .RX_RATE : ("Reaction Rate" , "mg/hr" ),
26+ oapi .LinkAttribute .FRCTN_FCTR : ("Friction Factor" , "unitless" )}
27+
28+ handle = oapi .init ()
29+ oapi .open (handle , OUTPUT_FILE_EXAMPLE1 )
30+
31+ om = OutputMetadata (handle )
1132
33+ for attr in oapi .NodeAttribute :
34+ temp = om .get_attribute_metadata (attr )
35+ assert temp == ref [attr ]
36+
1237 for attr in oapi .LinkAttribute :
1338 temp = om .get_attribute_metadata (attr )
14-
39+ assert temp == ref [attr ]
40+
0 commit comments