• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jqueguiner / num2words2 / 25217939620
95%
master: 94%

Build:
Build:
LAST BUILD BRANCH: feat/sentence-multilang-ordinals
DEFAULT BRANCH: master
Ran 01 May 2026 02:24PM UTC
Jobs 6
Files 335
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

01 May 2026 02:23PM UTC coverage: 95.199% (-0.07%) from 95.27%
25217939620

push

github

web-flow
feat(fraction): add to_fraction + 'n/d' string routing (#113)

Implements savoirfairelinux/num2words#584 — fraction support across
the dispatcher.

Public API:
  - num2words('1/3', lang='en')        # 'one third'
  - num2words('-3/4', lang='fr')       # 'moins trois quarts'
  - num2words('1/100', lang='de')      # 'ein Hundertstel'
  - explicit:  to_fraction(num, denom) on any converter

Plumbing:
  - Num2Word_Base.to_fraction() default = '<cardinal num> <ordinal denom>[s]'
  - Dispatcher detects 'n/d' string pattern (with whitespace tolerance)
    and routes directly to converter.to_fraction(int, int)
  - 'fraction' added to CONVERTES_TYPES

Per-language idiomatic forms:
  - English:    half/halves, quarter/quarters; ordinal+s otherwise
  - French:     demi(s), tiers (invariant), quart(s); ordinal+s otherwise
  - Spanish:    medio(s), tercio(s), cuarto(s); 'un' for numerator 1
  - Italian:    mezzo/mezzi; ordinal -o → -i for plural
  - Portuguese: meio(s), terço(s); inherited by pt_BR
  - German:     halb/halbe + Drittel/Viertel/...el (invariant plural);
                'ein' rather than 'eins' for numerator 1; 'Hundertstel'
                drops the redundant 'ein' prefix from einhundert

Edge cases handled:
  - 0/3 → 'zero' (collapses to cardinal)
  - 1/1 → 'one' (denominator 1 collapses to cardinal)
  - 1/-3 and -1/3 both → 'minus one third'
  - 1/0 → ZeroDivisionError

Tests: tests/test_584_fractions.py — 21 cases covering all six
languages, idiomatic vs ordinal-fallback denominators, signs, edge
cases, and the dispatcher's pattern recognition (whitespace, currency
not falsely routed).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

7988 of 8770 branches covered (91.08%)

Branch coverage included in aggregate %.

203 of 232 new or added lines in 9 files covered. (87.5%)

42165 of 43912 relevant lines covered (96.02%)

5.76 hits per line

Uncovered Changes

Lines Coverage ∆ File
13
87.14
-4.55% num2words2/base.py
5
86.8
-3.84% num2words2/lang_ES.py
2
70.55
1.38% num2words2/__init__.py
2
91.62
-0.41% num2words2/lang_DE.py
2
91.43
-2.48% num2words2/lang_FR.py
2
96.3
-1.6% num2words2/lang_IT.py
2
97.16
-2.84% num2words2/lang_PT.py
1
97.87
tests/test_584_fractions.py
Jobs
ID Job ID Ran Files Coverage
1 3.15 - 25217939620.1 01 May 2026 02:25PM UTC 335
95.2
GitHub Action Run
2 3.14 - 25217939620.2 01 May 2026 02:25PM UTC 335
95.2
GitHub Action Run
3 3.13 - 25217939620.3 01 May 2026 02:25PM UTC 335
95.2
GitHub Action Run
4 3.11 - 25217939620.4 01 May 2026 02:25PM UTC 335
95.2
GitHub Action Run
5 3.10 - 25217939620.5 01 May 2026 02:25PM UTC 335
95.2
GitHub Action Run
6 3.12 - 25217939620.6 01 May 2026 02:25PM UTC 335
95.2
GitHub Action Run
Source Files on build 25217939620
  • Tree
  • List 335
  • Changed 8
  • Source Changed 0
  • Coverage Changed 8
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • 5b7bfe39 on github
  • Prev Build on v1.0.12 (#25217503490)
  • Next Build on main (#25218394358)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc