mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 08:38:32 +02:00
Changes to appease ruff linter
This commit is contained in:
parent
ab78a09ccf
commit
dc05e29cda
3 changed files with 6 additions and 6 deletions
|
@ -9,7 +9,7 @@ import string
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree as ET
|
||||||
|
|
||||||
from pytest_bdd import given
|
from pytest_bdd import given
|
||||||
from pytest_bdd.parsers import parse
|
from pytest_bdd.parsers import parse
|
||||||
|
@ -168,7 +168,7 @@ def parse_output_as_language(cli_run, language_name):
|
||||||
actual_output = cli_run["stdout"]
|
actual_output = cli_run["stdout"]
|
||||||
|
|
||||||
if language_name == "XML":
|
if language_name == "XML":
|
||||||
parsed_output = ElementTree.fromstring(actual_output)
|
parsed_output = ET.fromstring(actual_output)
|
||||||
elif language_name == "JSON":
|
elif language_name == "JSON":
|
||||||
parsed_output = json.loads(actual_output)
|
parsed_output = json.loads(actual_output)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree as ET
|
||||||
|
|
||||||
from pytest_bdd import then
|
from pytest_bdd import then
|
||||||
from pytest_bdd.parsers import parse
|
from pytest_bdd.parsers import parse
|
||||||
|
@ -300,7 +300,7 @@ def cache_dir_contains_files(file_list, cache_dir):
|
||||||
def assert_output_is_valid_language(cli_run, language_name):
|
def assert_output_is_valid_language(cli_run, language_name):
|
||||||
language_name = language_name.upper()
|
language_name = language_name.upper()
|
||||||
if language_name == "XML":
|
if language_name == "XML":
|
||||||
xml_tree = ElementTree.fromstring(cli_run["stdout"])
|
xml_tree = ET.fromstring(cli_run["stdout"])
|
||||||
assert xml_tree, "Invalid XML"
|
assert xml_tree, "Invalid XML"
|
||||||
elif language_name == "JSON":
|
elif language_name == "JSON":
|
||||||
assert json.loads(cli_run["stdout"]), "Invalid JSON"
|
assert json.loads(cli_run["stdout"]), "Invalid JSON"
|
||||||
|
@ -390,7 +390,7 @@ def assert_output_field_content(field_name, comparison, expected_keys, parsed_ou
|
||||||
@then(parse('there should be {number:d} "{item}" elements'))
|
@then(parse('there should be {number:d} "{item}" elements'))
|
||||||
def count_elements(number, item, cli_run):
|
def count_elements(number, item, cli_run):
|
||||||
actual_output = cli_run["stdout"]
|
actual_output = cli_run["stdout"]
|
||||||
xml_tree = ElementTree.fromstring(actual_output)
|
xml_tree = ET.fromstring(actual_output)
|
||||||
assert len(xml_tree.findall(".//" + item)) == number
|
assert len(xml_tree.findall(".//" + item)) == number
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -296,7 +296,7 @@ class TestDeserialization:
|
||||||
)
|
)
|
||||||
def test_deserialize_multiword_strings(self, input_str):
|
def test_deserialize_multiword_strings(self, input_str):
|
||||||
runtime_config = make_yaml_valid_dict(input_str)
|
runtime_config = make_yaml_valid_dict(input_str)
|
||||||
assert runtime_config.__class__ == dict
|
assert runtime_config.__class__ is dict
|
||||||
assert input_str[0] in runtime_config
|
assert input_str[0] in runtime_config
|
||||||
assert runtime_config[input_str[0]] == input_str[1]
|
assert runtime_config[input_str[0]] == input_str[1]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue