Skip to content

Commit 918b16f

Browse files
Copilotnijel
andcommitted
Fix linting issues
Co-authored-by: nijel <212189+nijel@users.noreply.github.com>
1 parent 9f5ff5a commit 918b16f

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

weblate/formats/tests/test_formats.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,8 +1113,7 @@ def tearDown(self) -> None:
11131113

11141114
def test_save_preserves_source_field(self) -> None:
11151115
"""
1116-
Test that saving a CSV Simple file with a monolingual base preserves
1117-
the source field correctly in the output.
1116+
Test that saving a CSV Simple file preserves source fields.
11181117
11191118
This reproduces the issue where translations are saved with empty source
11201119
fields instead of preserving the context/key from the base file.
@@ -1129,15 +1128,11 @@ def test_save_preserves_source_field(self) -> None:
11291128
f.write(content)
11301129

11311130
# Load the base file (template)
1132-
base_format = CSVUtf8SimpleFormat(
1133-
TEST_CSV_SIMPLE_EN, is_template=True
1134-
)
1131+
base_format = CSVUtf8SimpleFormat(TEST_CSV_SIMPLE_EN, is_template=True)
11351132

11361133
# Load the translation file with the template
11371134
translation_format = CSVUtf8SimpleFormat(
1138-
translation_file,
1139-
template_store=base_format.store,
1140-
language_code='pl'
1135+
translation_file, template_store=base_format.store, language_code="pl"
11411136
)
11421137

11431138
# Verify we have the expected units
@@ -1149,7 +1144,9 @@ def test_save_preserves_source_field(self) -> None:
11491144
if unit.context == "objectAccessDenied":
11501145
unit.set_target("Nie masz uprawnien do modyfikowania obiektu '%s'")
11511146
elif unit.context == "propAccessDenied":
1152-
unit.set_target("Nie masz uprawnien do modyfikowania wlasciwosci: %s (tytul obiektu: %s)")
1147+
unit.set_target(
1148+
"Nie masz uprawnien do modyfikowania wlasciwosci: %s (tytul obiektu: %s)"
1149+
)
11531150
elif unit.context == "noReadPermission":
11541151
unit.set_target("Nie masz uprawnien do odczytu obiektu '%s'")
11551152

@@ -1158,16 +1155,17 @@ def test_save_preserves_source_field(self) -> None:
11581155

11591156
# Read the saved content
11601157
with open(translation_file, "rb") as f:
1161-
saved_content = f.read().decode('utf-8')
1158+
saved_content = f.read().decode("utf-8")
11621159

11631160
# Check that the source fields are not empty
1164-
lines = saved_content.strip().split('\n')
1161+
lines = saved_content.strip().split("\n")
11651162

11661163
# Skip header
11671164
for line in lines[1:]:
11681165
# Parse the line
11691166
import csv
1170-
reader = csv.reader([line], delimiter=';', quotechar='"')
1167+
1168+
reader = csv.reader([line], delimiter=";", quotechar='"')
11711169
for row in reader:
11721170
if len(row) >= 2:
11731171
source_field = row[0]
@@ -1177,7 +1175,7 @@ def test_save_preserves_source_field(self) -> None:
11771175
self.assertNotEqual(
11781176
source_field,
11791177
"",
1180-
f"Source field is empty for target: {target_field}"
1178+
f"Source field is empty for target: {target_field}",
11811179
)
11821180

11831181

0 commit comments

Comments
 (0)