From fb6f182b1f0898fd7a7f6961160e215ceae8a17c Mon Sep 17 00:00:00 2001 From: Daniel Hornung <d.hornung@indiscale.com> Date: Wed, 20 Mar 2024 23:19:16 +0100 Subject: [PATCH] WIP: Handling illegal characters. --- .../data/simple_data_ascii_chars.json | 18 ++++++++++++++++++ .../table_json_conversion/test_fill_xlsx.py | 6 +++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 unittests/table_json_conversion/data/simple_data_ascii_chars.json diff --git a/unittests/table_json_conversion/data/simple_data_ascii_chars.json b/unittests/table_json_conversion/data/simple_data_ascii_chars.json new file mode 100644 index 00000000..049b7203 --- /dev/null +++ b/unittests/table_json_conversion/data/simple_data_ascii_chars.json @@ -0,0 +1,18 @@ +{ + "Training": { + "date": "2023-01-01", + "url": "char: \u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009", + "subjects": [ + "\u000a\u000b\u000c\u000d\u000e\u000f", + "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017", + "\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f", + "\u0020\u0021\u0022\u0023\u0024\u0025\u0026\u0027", + "\u0028\u0029\u002a\u002b\u002c\u002d\u002e\u002f" + ] + }, + "Person": { + "family_name": "Steve:", + "given_name": "Stevie", + "Organisation": "IMF" + } +} diff --git a/unittests/table_json_conversion/test_fill_xlsx.py b/unittests/table_json_conversion/test_fill_xlsx.py index 52416343..8609a6eb 100644 --- a/unittests/table_json_conversion/test_fill_xlsx.py +++ b/unittests/table_json_conversion/test_fill_xlsx.py @@ -130,12 +130,16 @@ def test_fill_xlsx(): template_file=rfp("data/multiple_refs_template.xlsx"), known_good=rfp("data/multiple_refs_data.xlsx"), schema=rfp("data/multiple_refs_schema.json")) - fill_and_compare(json_file=rfp("data/indirect_data.json"), template_file=rfp("data/indirect_template.xlsx"), known_good=rfp("data/indirect_data.xlsx"), schema=rfp("data/indirect_schema.json")) + fill_and_compare(json_file=rfp("data/simple_data_ascii_chars.json"), + template_file=rfp("data/simple_template.xlsx"), + known_good=rfp("data/simple_data.xlsx"), + schema=rfp("data/simple_schema.json")) + def test_errors(): with pytest.raises(AssertionError) as exc: -- GitLab