From 5469ae6250f7d18711c35346727becb0dca2083b Mon Sep 17 00:00:00 2001 From: Grzegorz Orczykowski Date: Fri, 22 Sep 2023 00:19:36 +0200 Subject: [PATCH] Formatted code --- pyxform/xls2json.py | 16 +++++++++++----- tests/test_image_app_parameter.py | 15 ++++++--------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/pyxform/xls2json.py b/pyxform/xls2json.py index 75c2528b..1ae15bb1 100644 --- a/pyxform/xls2json.py +++ b/pyxform/xls2json.py @@ -1310,7 +1310,13 @@ def workbook_to_json( if row.get("default"): new_dict["default"] = process_image_default(row["default"]) - parameters_generic.validate(parameters=parameters, allowed=("max-pixels","app",)) + parameters_generic.validate( + parameters=parameters, + allowed=( + "max-pixels", + "app", + ), + ) if "max-pixels" in parameters.keys(): try: int(parameters["max-pixels"]) @@ -1326,13 +1332,13 @@ def workbook_to_json( ) if "app" in parameters.keys(): - android_package_regex_pattern = "^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$" + android_package_regex_pattern = ( + "^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$" + ) app_package_name = str(parameters["app"]) if re.fullmatch(android_package_regex_pattern, app_package_name): new_dict["control"] = new_dict.get("control", {}) - new_dict["control"].update( - {"intent": app_package_name} - ) + new_dict["control"].update({"intent": app_package_name}) else: raise PyXFormError("Invalid Android package name format") diff --git a/tests/test_image_app_parameter.py b/tests/test_image_app_parameter.py index 7b57b5e7..8fd25007 100644 --- a/tests/test_image_app_parameter.py +++ b/tests/test_image_app_parameter.py @@ -6,13 +6,12 @@ class ImageAppParameterTest(PyxformTestCase): - def test_valid_android_package_name(self): self.assertPyxformXform( name="data", md=""" - | survey | | | | | - | | type | name | label | parameters | + | survey | | | | | + | | type | name | label | parameters | | | image | my_image | Image | app=com.jeyluta.timestampcamerafree | """, xml__xpath_match=[ @@ -25,11 +24,9 @@ def test_invalid_android_package_name(self): name="data", errored=True, md=""" - | survey | | | | | - | | type | name | label | parameters | + | survey | | | | | + | | type | name | label | parameters | | | image | my_image | Image | app=something | """, - error__contains=[ - "Invalid Android package name format" - ], - ) \ No newline at end of file + error__contains=["Invalid Android package name format"], + )