@@ -70,6 +70,32 @@ def mr3():
7070 return ms .model_result (fn , item = 0 , name = "SW_3" )
7171
7272
73+ def test_properties_after_match (o1 , mr1 ):
74+ cmp = ms .match (o1 , mr1 )
75+ assert cmp .n_models == 1
76+ assert cmp .n_points == 386
77+ assert cmp .x == 4.242
78+ assert cmp .y == 52.6887
79+ assert cmp .z is None
80+ assert cmp .name == "HKNA"
81+ assert cmp .gtype == "point"
82+ assert cmp .mod_names == ["SW_1" ]
83+
84+
85+ def test_properties_after_match_ts (o1 ):
86+ fn = "tests/testdata/SW/HKNA_Hm0.dfs0"
87+ mr = ms .PointModelResult (fn , item = 0 , name = "SW_1" )
88+ cmp = ms .match (o1 , mr )
89+ assert cmp .n_models == 1
90+ assert cmp .n_points == 564
91+ assert cmp .x == 4.242
92+ assert cmp .y == 52.6887
93+ assert cmp .z is None
94+ assert cmp .name == "HKNA"
95+ assert cmp .gtype == "point"
96+ assert cmp .mod_names == ["SW_1" ]
97+
98+
7399# TODO remove in v1.1
74100def test_compare_multi_obs_multi_model_is_deprecated (o1 , o2 , o3 , mr1 , mr2 ):
75101 with pytest .warns (FutureWarning , match = "match" ):
@@ -543,12 +569,20 @@ def test_compare_model_vs_dummy_for_track(mr1, o3):
543569 # better than dummy 🙂
544570 assert cmp2 .score ()["SW_1" ] == pytest .approx (0.3524703 )
545571
546- def test_match_obs_model_pos_args_wrong_order_helpful_error_message ():
547572
573+ def test_match_obs_model_pos_args_wrong_order_helpful_error_message ():
548574 # match is pretty helpful in converting strings or dataset
549575 # so we need to use a ModelResult to trigger the error
550- mr = ms .PointModelResult (data = pd .Series ([0.0 ,0.0 ], index = pd .date_range ("1970" , periods = 2 , freq = 'd' )), name = "Zero" )
551- obs = ms .PointObservation (data = pd .Series ([1.0 , 2.0 , 3.0 ], index = pd .date_range ("1970" , periods = 3 , freq = 'h' )), name = "MyStation" )
576+ mr = ms .PointModelResult (
577+ data = pd .Series ([0.0 , 0.0 ], index = pd .date_range ("1970" , periods = 2 , freq = "d" )),
578+ name = "Zero" ,
579+ )
580+ obs = ms .PointObservation (
581+ data = pd .Series (
582+ [1.0 , 2.0 , 3.0 ], index = pd .date_range ("1970" , periods = 3 , freq = "h" )
583+ ),
584+ name = "MyStation" ,
585+ )
552586
553587 with pytest .raises (TypeError , match = "order" ):
554- ms .match (mr , obs )
588+ ms .match (mr , obs )
0 commit comments