1111from funcy import first
1212
1313from dvc .cli import main
14- from dvc .render import REVISION
14+ from dvc .render import ANCHOR_DEFINITIONS , FILENAME , REVISION
1515
1616JSON_OUT = "vis_data"
1717
@@ -116,7 +116,7 @@ def verify_vega(
116116
117117 assert (
118118 json_result [0 ]["content" ]["data" ]["values" ]
119- == split_json_result [0 ]["anchor_definitions" ]["<DVC_METRIC_DATA>" ]
119+ == split_json_result [0 ][ANCHOR_DEFINITIONS ]["<DVC_METRIC_DATA>" ]
120120 )
121121
122122 assert set (versions ) == set (json_result [0 ]["revisions" ])
@@ -138,10 +138,8 @@ def _assert_templates_equal(
138138 tmp2 = deepcopy (filled_template )
139139 tmp3 = json .loads (
140140 json .dumps (split_template )
141- .replace ('"<DVC_METRIC_COLUMN_WIDTH>"' , "300" )
142141 .replace ('"<DVC_METRIC_PLOT_HEIGHT>"' , "300" )
143142 .replace ('"<DVC_METRIC_PLOT_WIDTH>"' , "300" )
144- .replace ('"<DVC_METRIC_ROW_HEIGHT>"' , "300" )
145143 .replace ("<DVC_METRIC_TITLE>" , title )
146144 .replace ("<DVC_METRIC_X_LABEL>" , x_label )
147145 .replace ("<DVC_METRIC_Y_LABEL>" , y_label )
@@ -231,7 +229,7 @@ def test_repo_with_plots(tmp_dir, scm, dvc, capsys, run_copy_metrics, repo_with_
231229 ] == _update_datapoints (
232230 linear_v1 ,
233231 {
234- "rev" : "workspace" ,
232+ REVISION : "workspace" ,
235233 },
236234 )
237235 assert html_result ["linear.json" ]["data" ]["values" ] == _update_datapoints (
@@ -245,13 +243,13 @@ def test_repo_with_plots(tmp_dir, scm, dvc, capsys, run_copy_metrics, repo_with_
245243 ] == _update_datapoints (
246244 confusion_v1 ,
247245 {
248- "rev" : "workspace" ,
246+ REVISION : "workspace" ,
249247 },
250248 )
251249 assert html_result ["confusion.json" ]["data" ]["values" ] == _update_datapoints (
252250 confusion_v1 ,
253251 {
254- "rev" : "workspace" ,
252+ REVISION : "workspace" ,
255253 },
256254 )
257255 verify_image (tmp_dir , "workspace" , "image.png" , image_v1 , html_path , json_data )
@@ -319,12 +317,12 @@ def test_repo_with_plots(tmp_dir, scm, dvc, capsys, run_copy_metrics, repo_with_
319317 ] == _update_datapoints (
320318 linear_v2 ,
321319 {
322- "rev" : "workspace" ,
320+ REVISION : "workspace" ,
323321 },
324322 ) + _update_datapoints (
325323 linear_v1 ,
326324 {
327- "rev" : "HEAD" ,
325+ REVISION : "HEAD" ,
328326 },
329327 )
330328 assert html_result ["../linear.json" ]["data" ]["values" ] == _update_datapoints (
@@ -343,12 +341,12 @@ def test_repo_with_plots(tmp_dir, scm, dvc, capsys, run_copy_metrics, repo_with_
343341 ] == _update_datapoints (
344342 confusion_v2 ,
345343 {
346- "rev" : "workspace" ,
344+ REVISION : "workspace" ,
347345 },
348346 ) + _update_datapoints (
349347 confusion_v1 ,
350348 {
351- "rev" : "HEAD" ,
349+ REVISION : "HEAD" ,
352350 },
353351 )
354352 assert html_result ["../confusion.json" ]["data" ]["values" ] == _update_datapoints (
@@ -477,20 +475,20 @@ def test_repo_with_config_plots(tmp_dir, capsys, repo_with_config_plots):
477475 ble = _update_datapoints (
478476 plots ["data" ]["linear_train.json" ],
479477 {
480- "rev" : "workspace" ,
481- "filename" : "linear_train.json" ,
478+ REVISION : "workspace" ,
479+ FILENAME : "linear_train.json" ,
482480 },
483481 ) + _update_datapoints (
484482 plots ["data" ]["linear_test.json" ],
485483 {
486- "rev" : "workspace" ,
487- "filename" : "linear_test.json" ,
484+ REVISION : "workspace" ,
485+ FILENAME : "linear_test.json" ,
488486 },
489487 )
490488
491489 assert html_result ["linear_train_vs_test" ]["data" ]["values" ] == ble
492490 assert (
493- split_json_result ["data" ]["linear_train_vs_test" ][0 ]["anchor_definitions" ][
491+ split_json_result ["data" ]["linear_train_vs_test" ][0 ][ANCHOR_DEFINITIONS ][
494492 "<DVC_METRIC_DATA>"
495493 ]
496494 == ble
0 commit comments