Skip to content

Commit abf5011

Browse files
committed
fix: lint issues
1 parent 91427cc commit abf5011

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

.coverage

0 Bytes
Binary file not shown.

dev.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def run_command(cmd: list[str], description: str) -> bool:
1010
"""Run a command and return True if successful."""
1111
print(f"\n🔍 {description}...")
1212
try:
13-
result = subprocess.run(cmd, check=True, cwd=Path(__file__).parent)
13+
subprocess.run(cmd, check=True, cwd=Path(__file__).parent)
1414
print(f"✅ {description} passed!")
1515
return True
1616
except subprocess.CalledProcessError as e:
@@ -32,7 +32,7 @@ def main() -> None:
3232

3333
if command in ("test", "all"):
3434
success &= run_command([
35-
"pytest", "--cov=json2xml", "--cov-report=term",
35+
"pytest", "--cov=json2xml", "--cov-report=term",
3636
"-xvs", "tests", "-n", "auto"
3737
], "Tests")
3838

@@ -50,11 +50,11 @@ def main() -> None:
5050
return
5151

5252
if not success:
53-
print(f"\n❌ Some checks failed!")
53+
print("\n❌ Some checks failed!")
5454
sys.exit(1)
5555
else:
56-
print(f"\n🎉 All checks passed!")
56+
print("\n🎉 All checks passed!")
5757

5858

5959
if __name__ == "__main__":
60-
main()
60+
main()

tests/test_dict2xml.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ def test_attrs_comprehensive_xml_escaping(self) -> None:
10841084
'Element': {
10851085
"@attrs": {
10861086
"ampersand": "Tom & Jerry",
1087-
"less_than": "value < 10",
1087+
"less_than": "value < 10",
10881088
"greater_than": "value > 5",
10891089
"quotes": 'He said "Hello"',
10901090
"single_quotes": "It's working",
@@ -1094,15 +1094,15 @@ def test_attrs_comprehensive_xml_escaping(self) -> None:
10941094
}
10951095
}
10961096
result = dicttoxml.dicttoxml(data, attr_type=False, item_wrap=False, root=False).decode('utf-8')
1097-
1097+
10981098
# Check that all special characters are properly escaped in attributes
10991099
assert 'ampersand="Tom &amp; Jerry"' in result
11001100
assert 'less_than="value &lt; 10"' in result
11011101
assert 'greater_than="value &gt; 5"' in result
11021102
assert 'quotes="He said &quot;Hello&quot;"' in result
11031103
assert 'single_quotes="It&apos;s working"' in result
11041104
assert 'mixed="Tom &amp; Jerry &lt; 10 &gt; 5 &quot;quoted&quot; &apos;apostrophe&apos;"' in result
1105-
1105+
11061106
# Verify the element content is also properly escaped
11071107
assert ">content<" in result
11081108

@@ -1118,28 +1118,28 @@ def test_attrs_empty_and_none_values(self) -> None:
11181118
}
11191119
}
11201120
result = dicttoxml.dicttoxml(data, attr_type=False, item_wrap=False, root=False).decode('utf-8')
1121-
1121+
11221122
assert 'empty=""' in result
1123-
assert 'zero="0"' in result
1123+
assert 'zero="0"' in result
11241124
assert 'false="False"' in result
11251125

11261126
def test_make_attrstring_function_directly(self) -> None:
11271127
"""Test the make_attrstring function directly."""
11281128
from json2xml.dicttoxml import make_attrstring
1129-
1129+
11301130
# Test basic escaping
11311131
attrs = {
11321132
"test": "value <here>",
1133-
"ampersand": "Tom & Jerry",
1133+
"ampersand": "Tom & Jerry",
11341134
"quotes": 'Say "hello"'
11351135
}
11361136
result = make_attrstring(attrs)
1137-
1137+
11381138
assert 'test="value &lt;here&gt;"' in result
11391139
assert 'ampersand="Tom &amp; Jerry"' in result
11401140
assert 'quotes="Say &quot;hello&quot;"' in result
1141-
1141+
11421142
# Test empty attributes
1143-
empty_attrs = {}
1143+
empty_attrs: dict[str, Any] = {}
11441144
result = make_attrstring(empty_attrs)
11451145
assert result == ""

0 commit comments

Comments
 (0)