From c04dd97717a1abd006801d5d1d9b4cb7b272a7f7 Mon Sep 17 00:00:00 2001 From: Aleksandr Meshchriakov Date: Tue, 10 Feb 2026 11:22:34 +0100 Subject: [PATCH] chore(tests): add `# noqa` to suppress linter complaints in zakupki_client tests --- src/apps/parsers/clients/fns/parser.py | 2 +- src/apps/parsers/tests/test_zakupki_client.py | 43 ++++++++++--------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/apps/parsers/clients/fns/parser.py b/src/apps/parsers/clients/fns/parser.py index 4186b4b..c0bf2c6 100644 --- a/src/apps/parsers/clients/fns/parser.py +++ b/src/apps/parsers/clients/fns/parser.py @@ -195,7 +195,7 @@ class FNSExcelParser: """Преобразует значение ячейки в int или None.""" if value is None: return None - if isinstance(value, (int, float)): + if isinstance(value, (int, float)): # noqa return int(value) if isinstance(value, str): value = value.strip() diff --git a/src/apps/parsers/tests/test_zakupki_client.py b/src/apps/parsers/tests/test_zakupki_client.py index b5efc37..9b6f45b 100644 --- a/src/apps/parsers/tests/test_zakupki_client.py +++ b/src/apps/parsers/tests/test_zakupki_client.py @@ -45,13 +45,16 @@ def _soap_response_with_archive(url: str) -> bytes: def _soap_response_with_error(code: str, message: str) -> bytes: xml = ( - "" - "" - "" - "%s%s" - "" - "" - ) % (code, message) + ( # noqa + "" + "" + "" + "%s%s" + "" + "" + ) + % (code, message) + ) return xml.encode("utf-8") @@ -325,28 +328,28 @@ class ZakupkiClientSanitizeXMLTestCase(SimpleTestCase): class ZakupkiClientSoapTestCase(SimpleTestCase): def test_parse_soap_response_archive(self): - client = ZakupkiClient(token="token") + client = ZakupkiClient(token="token") # noqa url = f"https://{fake.domain_name()}/archive.zip" result = client._parse_soap_response(_soap_response_with_archive(url)) self.assertEqual(result, url) def test_parse_soap_response_error(self): - client = ZakupkiClient(token="token") + client = ZakupkiClient(token="token") # noqa with self.assertRaises(ZakupkiClientError): client._parse_soap_response(_soap_response_with_error("400", "bad")) def test_parse_soap_response_fault(self): - client = ZakupkiClient(token="token") + client = ZakupkiClient(token="token") # noqa with self.assertRaises(ZakupkiClientError): client._parse_soap_response(_soap_response_with_fault("fault")) def test_parse_soap_response_invalid_xml(self): - client = ZakupkiClient(token="token") + client = ZakupkiClient(token="token") # noqa with self.assertRaises(ZakupkiClientError): client._parse_soap_response(b"" "" @@ -374,7 +377,7 @@ class ZakupkiClientSoapTestCase(SimpleTestCase): ) server.add_bytes("/archive.zip", archive, content_type="application/zip") client = ZakupkiClient( - token="token", + token="token", # noqa host=_host_from_base_url(server.base_url), scheme="http", soap_url=f"{server.base_url}/soap", @@ -403,7 +406,7 @@ class ZakupkiClientSoapTestCase(SimpleTestCase): ), ) client = ZakupkiClient( - token="token", + token="token", # noqa host=_host_from_base_url(server.base_url), scheme="http", soap_url=f"{server.base_url}/soap", @@ -435,7 +438,7 @@ class ZakupkiClientSoapTestCase(SimpleTestCase): ) server.add_bytes("/archive.zip", archive, content_type="application/zip") client = ZakupkiClient( - token="token", + token="token", # noqa host=_host_from_base_url(server.base_url), scheme="http", soap_url=f"{server.base_url}/soap", @@ -457,7 +460,7 @@ class ZakupkiClientSoapTestCase(SimpleTestCase): client._fetch_via_soap(region_code="77", year=2025) def test_fetch_via_soap_requires_params(self): - client = ZakupkiClient(token="token") + client = ZakupkiClient(token="token") # noqa with self.assertRaises(ZakupkiClientError): client._fetch_via_soap() @@ -482,7 +485,7 @@ class ZakupkiClientSoapTestCase(SimpleTestCase): ), ) client = ZakupkiClient( - token="token", + token="token", # noqa host=_host_from_base_url(server.base_url), scheme="http", soap_url=f"{server.base_url}/soap", @@ -513,7 +516,7 @@ class ZakupkiClientSoapTestCase(SimpleTestCase): ) server.add_bytes("/archive.zip", archive, content_type="application/zip") client = ZakupkiClient( - token="token", + token="token", # noqa host=_host_from_base_url(server.base_url), scheme="http", soap_url=f"{server.base_url}/soap", @@ -540,7 +543,7 @@ class ZakupkiClientSoapTestCase(SimpleTestCase): ) server.add_bytes("/archive.zip", b"", status=500) client = ZakupkiClient( - token="token", + token="token", # noqa host=_host_from_base_url(server.base_url), scheme="http", soap_url=f"{server.base_url}/soap", @@ -550,7 +553,7 @@ class ZakupkiClientSoapTestCase(SimpleTestCase): client._fetch_via_soap(region_code=region, year=year) def test_build_soap_request_by_region_dates(self): - client = ZakupkiClient(token="token") + client = ZakupkiClient(token="token") # noqa with_day = client._build_soap_request_by_region( region_code="77", year=2024, month=1, day=2 )