diff options
author | Benjamin Klimczak <benjamin.klimczak@arm.com> | 2022-11-07 12:04:06 +0000 |
---|---|---|
committer | Benjamin Klimczak <benjamin.klimczak@arm.com> | 2022-11-09 11:23:32 +0000 |
commit | f77ffbd3033d122a375c3be63624ea80507d0541 (patch) | |
tree | 0465aafdba081f15a769c5929ed5d3b5610bbed1 /tests | |
parent | 006c95f3053c89af41726c582c7b4d0f9914553b (diff) | |
download | mlia-f77ffbd3033d122a375c3be63624ea80507d0541.tar.gz |
MLIA-275 Remove support for CSV output
Change-Id: I212c9cad5f2ac28b75b1d9e2fb8f1f8b444b8397
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_cli_options.py | 3 | ||||
-rw-r--r-- | tests/test_core_reporting.py | 79 | ||||
-rw-r--r-- | tests/test_devices_ethosu_reporters.py | 87 |
3 files changed, 4 insertions, 165 deletions
diff --git a/tests/test_cli_options.py b/tests/test_cli_options.py index f898146..d75f7c0 100644 --- a/tests/test_cli_options.py +++ b/tests/test_cli_options.py @@ -147,9 +147,6 @@ def test_get_target_opts(args: dict | None, expected_opts: list[str]) -> None: [["--output", "report.json"], "report.json"], [["--output", "REPORT.JSON"], "REPORT.JSON"], [["--output", "some_folder/report.json"], "some_folder/report.json"], - [["--output", "report.csv"], "report.csv"], - [["--output", "REPORT.CSV"], "REPORT.CSV"], - [["--output", "some_folder/report.csv"], "some_folder/report.csv"], ], ) def test_output_options(output_parameters: list[str], expected_path: str) -> None: diff --git a/tests/test_core_reporting.py b/tests/test_core_reporting.py index da7998c..feff5cc 100644 --- a/tests/test_core_reporting.py +++ b/tests/test_core_reporting.py @@ -95,9 +95,6 @@ def test_table_representation(with_notes: bool, expected_text_report: str) -> No ) table = sample_table(with_notes) - csv_repr = table.to_csv() - assert csv_repr == [["Header 2", "Header 3"], [2, 3], [5, 123123]] - json_repr = table.to_json() assert json_repr == { "sample_table": [ @@ -110,48 +107,8 @@ def test_table_representation(with_notes: bool, expected_text_report: str) -> No assert text_report == expected_text_report -def test_csv_nested_table_representation() -> None: - """Test representation of the nested tables in csv format.""" - - def sample_table(num_of_cols: int) -> Table: - columns = [ - Column("Header 1", alias="header1"), - Column("Header 2", alias="header2"), - ] - - rows = [ - ( - 1, - Table( - columns=[ - Column(f"Nested column {i+1}") for i in range(num_of_cols) - ], - rows=[[f"value{i+1}" for i in range(num_of_cols)]], - name="Nested table", - ), - ) - ] - - return Table(columns, rows, name="Sample table", alias="sample_table") - - assert sample_table(num_of_cols=2).to_csv() == [ - ["Header 1", "Header 2"], - [1, "value1;value2"], - ] - - assert sample_table(num_of_cols=1).to_csv() == [ - ["Header 1", "Header 2"], - [1, "value1"], - ] - - assert sample_table(num_of_cols=0).to_csv() == [ - ["Header 1", "Header 2"], - [1, ""], - ] - - @pytest.mark.parametrize( - "report, expected_plain_text, expected_json_data, expected_csv_data", + "report, expected_plain_text, expected_json_data", [ ( NestedReport( @@ -168,10 +125,6 @@ Sample report: { "sample_report": {"item": "item_value"}, }, - [ - ("item",), - ("item_value",), - ], ), ( NestedReport( @@ -196,10 +149,6 @@ Sample report: "item": {"nested_item": "nested_item_value"}, }, }, - [ - ("item", "nested_item"), - ("item_value", "nested_item_value"), - ], ), ( NestedReport( @@ -224,10 +173,6 @@ Sample report: "item": {"nested_item": {"unit": "bytes", "value": 10}}, }, }, - [ - ("item", "nested_item_value", "nested_item_unit"), - ("item_value", 10, "bytes"), - ], ), ( NestedReport( @@ -260,10 +205,6 @@ Sample report: "item": {"nested_item": 10}, }, }, - [ - ("item", "nested_item"), - ("item_value", 10), - ], ), ( NestedReport( @@ -296,10 +237,6 @@ Sample report: "item": {"nested_item": 10}, }, }, - [ - ("item", "nested_item"), - ("item_value", 10), - ], ), ( NestedReport( @@ -326,10 +263,6 @@ Sample report: "item": {"nested_item": 10}, }, }, - [ - ("item", "nested_item"), - ("item_value", 10), - ], ), ( NestedReport( @@ -358,10 +291,6 @@ Sample report: "item": {"nested_item": 10}, }, }, - [ - ("item", "nested_item"), - ("item_value", 10), - ], ), ], ) @@ -369,7 +298,6 @@ def test_nested_report_representation( report: NestedReport, expected_plain_text: str, expected_json_data: dict, - expected_csv_data: list, ) -> None: """Test representation of the NestedReport.""" plain_text = report.to_plain_text() @@ -378,9 +306,6 @@ def test_nested_report_representation( json_data = report.to_json() assert json_data == expected_json_data - csv_data = report.to_csv() - assert csv_data == expected_csv_data - def test_single_row_representation() -> None: """Test representation of the SingleRow.""" @@ -398,7 +323,6 @@ Single row example: column1 value1 """.strip() assert single_row.to_plain_text() == expected_text - assert single_row.to_csv() == [["column1"], ["value1"]] assert single_row.to_json() == {"simple_row_example": [{"column1": "value1"}]} with pytest.raises(Exception, match="Table should have only one row"): @@ -423,7 +347,6 @@ Single row example: ["", "plain_text"], ["some_file", "plain_text"], ["some_format.some_ext", "plain_text"], - ["output.csv", "csv"], ["output.json", "json"], ], ) diff --git a/tests/test_devices_ethosu_reporters.py b/tests/test_devices_ethosu_reporters.py index f8a7d86..f04270c 100644 --- a/tests/test_devices_ethosu_reporters.py +++ b/tests/test_devices_ethosu_reporters.py @@ -68,11 +68,6 @@ from mlia.utils.console import remove_ascii_codes doesnt_raise(), ], [ - "csv", - sys.stdout, - doesnt_raise(), - ], - [ "plain_text", "report.txt", doesnt_raise(), @@ -82,17 +77,12 @@ from mlia.utils.console import remove_ascii_codes "report.json", doesnt_raise(), ], - [ - "csv", - "report.csv", - doesnt_raise(), - ], ], ) def test_report( data: Any, formatters: list[Callable], - fmt: Literal["plain_text", "json", "csv"], + fmt: Literal["plain_text", "json"], output: Any, expected_error: Any, tmp_path: Path, @@ -111,7 +101,7 @@ def test_report( @pytest.mark.parametrize( - "ops, expected_plain_text, expected_json_dict, expected_csv_list", + "ops, expected_plain_text, expected_json_dict", [ ( [ @@ -187,17 +177,6 @@ Operators: }, ] }, - [ - ["Operator name", "Operator type", "Placement", "Notes"], - ["npu_supported", "test_type", "NPU", ""], - ["cpu_only", "test_type", "CPU", "CPU only operator"], - [ - "npu_unsupported", - "test_type", - "CPU", - "Not supported operator;Reason why operator is not supported", - ], - ], ), ], ) @@ -205,7 +184,6 @@ def test_report_operators( ops: list[Operator], expected_plain_text: str, expected_json_dict: dict, - expected_csv_list: list, monkeypatch: pytest.MonkeyPatch, ) -> None: """Test report_operatos formatter.""" @@ -221,12 +199,9 @@ def test_report_operators( json_dict = report.to_json() assert json_dict == expected_json_dict - csv_list = report.to_csv() - assert csv_list == expected_csv_list - @pytest.mark.parametrize( - "device, expected_plain_text, expected_json_dict, expected_csv_list", + "device, expected_plain_text, expected_json_dict", [ [ EthosUConfiguration("ethos-u55-256"), @@ -322,58 +297,6 @@ def test_report_operators( }, } }, - [ - ( - "target", - "mac", - "memory_mode", - "const_mem_area", - "arena_mem_area", - "cache_mem_area", - "arena_cache_size_value", - "arena_cache_size_unit", - "system_config", - "accelerator_clock_value", - "accelerator_clock_unit", - "axi0_port", - "axi1_port", - "clock_scales", - "burst_length_value", - "burst_length_unit", - "read_latency_value", - "read_latency_unit", - "write_latency_value", - "write_latency_unit", - "permanent_storage_mem_area", - "feature_map_storage_mem_area", - "fast_storage_mem_area", - ), - ( - "ethos-u55", - 256, - "Shared_Sram", - "Axi1", - "Axi0", - "Axi0", - 2096768, - "bytes", - "Ethos_U55_High_End_Embedded", - 500000000.0, - "Hz", - "Sram", - "OffChipFlash", - 0.125, - 128, - "bytes", - 64, - "cycles", - 64, - "cycles", - "OffChipFlash", - "Sram", - "Sram", - ), - ], ], ], ) @@ -381,7 +304,6 @@ def test_report_device_details( device: EthosUConfiguration, expected_plain_text: str, expected_json_dict: dict, - expected_csv_list: list, ) -> None: """Test report_operatos formatter.""" report = report_device_details(device) @@ -393,9 +315,6 @@ def test_report_device_details( json_dict = report.to_json() assert json_dict == expected_json_dict - csv_list = report.to_csv() - assert csv_list == expected_csv_list - def test_get_reporter(tmp_path: Path) -> None: """Test reporter functionality.""" |