@@ -2753,6 +2753,52 @@ def test_validate_data_dict(data_dict, error_messages, caplog, request):
27532753 ],
27542754 id = "reserved-prefix" ,
27552755 ),
2756+ pytest .param (
2757+ alter_dict (
2758+ TEMPLATE ,
2759+ "/ENTRY[my_entry]/NXODD_name[nxodd_name]/float_value" ,
2760+ {"compress" : np .float32 (2.0 ), "strength" : 4 },
2761+ ),
2762+ [],
2763+ id = "appdef-compressed-payload" ,
2764+ ),
2765+ pytest .param (
2766+ alter_dict (
2767+ TEMPLATE ,
2768+ "/ENTRY[my_entry]/NXODD_name[nxodd_name]/float_value" ,
2769+ {"compress" : np .bool_ (True ), "strength" : 3 },
2770+ ),
2771+ [
2772+ "The value at /my_entry/nxodd_name/float_value "
2773+ "should be one of the following Python types: "
2774+ "(<class 'float'>, <class 'numpy.floating'>), as defined in the "
2775+ "NXDL as NX_FLOAT."
2776+ ],
2777+ id = "appdef-compressed-payload-wrong-type" ,
2778+ ),
2779+ pytest .param (
2780+ alter_dict (
2781+ TEMPLATE ,
2782+ "/ENTRY[my_entry]/SAMPLE[sample1]]/changer_position" ,
2783+ {"compress" : np .int64 (2 ), "strength" : 2 },
2784+ ),
2785+ [],
2786+ id = "baseclass-compressed-payload" ,
2787+ ),
2788+ pytest .param (
2789+ alter_dict (
2790+ TEMPLATE ,
2791+ "/ENTRY[my_entry]/SAMPLE[sample1]]/changer_position" ,
2792+ {"compress" : np .float32 (2.0 ), "strength" : 3 },
2793+ ),
2794+ [
2795+ "The value at /my_entry/sample1/changer_position "
2796+ "should be one of the following Python types: "
2797+ "(<class 'int'>, <class 'numpy.integer'>), as defined in the "
2798+ "NXDL as NX_INT."
2799+ ],
2800+ id = "baseclass-compressed-payload-wrong-type" ,
2801+ ),
27562802 ],
27572803)
27582804def test_validate_nexus_file (data_dict , error_messages , caplog , tmp_path , request ):
@@ -2891,6 +2937,6 @@ def test_validate_cli(caplog, cli_inputs, error_messages):
28912937 else :
28922938 with caplog .at_level (logging .INFO ):
28932939 result = runner .invoke (validate_cli , cli_inputs )
2894- # assert len(caplog.records) == len(error_messages)
2895- # for expected_message, rec in zip(error_messages, caplog.records):
2896- # assert expected_message == format_error_message(rec.message)
2940+ assert len (caplog .records ) == len (error_messages )
2941+ for expected_message , rec in zip (error_messages , caplog .records ):
2942+ assert expected_message == format_error_message (rec .message )
0 commit comments