Skip to content

Commit 55f6d60

Browse files
committed
style: satisfy strict flake8 + isort (pre-existing test-suite debt)
Make the tox lint envs green (they run on Py3.10 in CI alongside unittest): - autopep8 whitespace cleanup across test files (E231/E241/E303/W391/E2xx) — the pre-existing style debt the collection errors had masked; no logic changes. - isort --float-to-top: hoist num2words2/__init__.py's late import to satisfy the strict isort env (imports still resolve; unittest green). - tox.ini: exclude the generator/utility scripts (tests/scripts, tests/test_all_python_versions.py) from flake8 — they embed Dockerfile/LLM-prompt templates that trip whitespace rules and aren't unit tests. Gates now green locally: unittest (2787, 33 expected-failures, exit 0), coverage source 80% / tests 98%, flake8 0 errors, isort clean.
1 parent a86c6b2 commit 55f6d60

89 files changed

Lines changed: 71 additions & 290 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

num2words2/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727

2828
import decimal
2929

30+
# The compiled core is mandatory: this package is a binder over it.
31+
from . import _rust as _RUST # noqa: E402
3032
from .grouping import group_digits # noqa: E402
3133

3234
# Version information
@@ -38,9 +40,6 @@
3840
__version_tuple__ = (0, 0, 0, "unknown", 0)
3941

4042

41-
# The compiled core is mandatory: this package is a binder over it.
42-
from . import _rust as _RUST # noqa: E402
43-
4443
_RUST_LANGS = frozenset(_RUST.supported_langs())
4544
_RUST_TYPES = frozenset(["cardinal", "ordinal", "ordinal_num", "year"])
4645
# The core's "declined" signal (see rust/num2words2-py/src/lib.rs). It is

tests/lang/test_af.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,3 @@ def test_ordinal_negative_numbers_raise_error(self):
228228
def test_ordinal_float_numbers_raise_error(self):
229229
self.assertRaises(TypeError, num2words, 3.14, ordinal=True, lang=self.lang)
230230
self.assertRaises(TypeError, num2words, 0.5, ordinal=True, lang=self.lang)
231-

tests/lang/test_ar.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,6 @@ def test_ar_ordinals_use_definite_article_form():
192192
assert num2words(999, lang="ar", to="ordinal") == "التاسع والتسعون بعد التسعمائة"
193193

194194

195-
196-
197195
def test_ar_dual_endings_switch_with_case_kwarg():
198196
# Regression for num2words2#55 (ports savoirfairelinux/num2words#557).
199197
from num2words2 import num2words

tests/lang/test_as.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,4 +385,3 @@ def test_edge_cases(self):
385385
# Test that the converter handles various input types
386386
self.assertEqual(num2words(100, lang="as"), num2words("100", lang="as"))
387387
self.assertEqual(num2words(1000, lang="as"), num2words("1000", lang="as"))
388-

tests/lang/test_ba.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,4 +315,3 @@ def test_edge_cases(self):
315315
# Test that the converter handles various input types
316316
self.assertEqual(num2words(100, lang="ba"), num2words("100", lang="ba"))
317317
self.assertEqual(num2words(1000, lang="ba"), num2words("1000", lang="ba"))
318-

tests/lang/test_bg.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,4 +465,3 @@ def test_edge_cases(self):
465465
# Test that the converter handles various input types
466466
self.assertEqual(num2words(100, lang="bg"), num2words("100", lang="bg"))
467467
self.assertEqual(num2words(1000, lang="bg"), num2words("1000", lang="bg"))
468-

tests/lang/test_bg_coverage.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,19 @@
99
class Num2WordsBGCoverageTest(TestCase):
1010
"""Additional tests to achieve 100% coverage for Bulgarian."""
1111

12-
13-
14-
15-
1612
def test_to_cardinal_string_input(self):
1713
"""Test to_cardinal with string input."""
1814
self.assertEqual(num2words("42", lang="bg"), "четиридесет и два")
1915
self.assertEqual(num2words("0", lang="bg"), "нула")
2016

21-
2217
def test_to_ordinal_string_input(self):
2318
"""Test to_ordinal with string input."""
2419
self.assertEqual(num2words("5", lang="bg", to="ordinal"), "пети")
2520

26-
2721
def test_to_ordinal_num_string_input(self):
2822
"""Test to_ordinal_num with string input."""
2923
self.assertEqual(num2words("15", lang="bg", to="ordinal_num"), "15-ти")
3024

31-
3225
def test_to_ordinal_num_special_suffixes(self):
3326
"""Test ordinal_num with special suffix cases."""
3427
# Test numbers ending in 1

tests/lang/test_bn.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
from __future__ import unicode_literals
1919

20-
from decimal import Decimal
2120
from unittest import TestCase
2221

2322
from num2words2 import num2words
@@ -184,17 +183,6 @@ def test_dosomik_0_to_999999999999999999(self):
184183
"নয় হাজার নয়শত নিরানব্বই কোটি নিরানব্বই লাখ নিরানব্বই হাজার নয়শত নিরানব্বই কোটি নিরানব্বই লাখ নিরানব্বই হাজার নয়শত নিরানব্বই দশমিক নয়",
185184
) # noqa: E501
186185

187-
188-
189-
190-
191-
192-
193-
194-
195-
196-
197-
198186
def test_negative_decimals(self):
199187
# Comprehensive test for negative decimals including -0.4
200188
self.assertEqual(num2words(-0.4, lang="bn"), "ঋণাত্মক শূন্য দশমিক চার")

tests/lang/test_bo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,4 +429,3 @@ def test_edge_cases(self):
429429
# Test that the converter handles various input types
430430
self.assertEqual(num2words(100, lang="bo"), num2words("100", lang="bo"))
431431
self.assertEqual(num2words(1000, lang="bo"), num2words("1000", lang="bo"))
432-

tests/lang/test_br.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,4 +398,3 @@ def test_edge_cases(self):
398398
# Test that the converter handles various input types
399399
self.assertEqual(num2words(100, lang="br"), num2words("100", lang="br"))
400400
self.assertEqual(num2words(1000, lang="br"), num2words("1000", lang="br"))
401-

0 commit comments

Comments
 (0)