@@ -506,3 +506,41 @@ def test_board_manual_pin_read():
506506
507507 # do a somewhat data-framey check
508508 assert df .shape [0 ] > 1
509+
510+
511+ def test_board_manual_construct_path ():
512+ fs = fsspec .filesystem ("file" )
513+ root = "pins/tests/pins-compat"
514+ path_df_csv = "df_csv/20220214T163718Z-eceac/"
515+ path_df_csv_v2 = "df_csv/20220214T163720Z-9bfad/df_csv.csv"
516+
517+ board = BoardManual (
518+ root ,
519+ fs ,
520+ pin_paths = {
521+ "df_csv" : path_df_csv ,
522+ "df_csv2_v2" : path_df_csv_v2 ,
523+ },
524+ )
525+
526+ # path to pin folder ----
527+ # creates path to pin, ignores version, can include data.txt
528+ assert board .construct_path (["df_csv" ]) == f"{ root } /{ path_df_csv } "
529+ assert board .construct_path (["df_csv" , "v" ]) == f"{ root } /{ path_df_csv } "
530+ assert (
531+ board .construct_path (["df_csv" , "v" , "data.txt" ])
532+ == f"{ root } /{ path_df_csv } data.txt"
533+ )
534+
535+ with pytest .raises (NotImplementedError ) as exc_info :
536+ board .construct_path (["df_csv" , "v" , "data.txt" , "too_much" ])
537+
538+ assert "Unable to construct path" in exc_info .value .args [0 ]
539+
540+ # path to individual file ----
541+ assert board .construct_path (["df_csv2_v2" ]) == f"{ root } /{ path_df_csv_v2 } "
542+
543+ with pytest .raises (ValueError ) as exc_info :
544+ board .construct_path (["df_csv2_v2" , "v" ])
545+
546+ assert "assumed to be a single file" in exc_info .value .args [0 ]
0 commit comments