Skip to content

Commit

Permalink
Fix error for 0/B
Browse files Browse the repository at this point in the history
  • Loading branch information
nielstron committed Jan 16, 2023
1 parent 06774a1 commit d08adba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion quantulum3/_lang/en_US/speak.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def unit_to_spoken(unit, count=1):
# derived unit
denominator_dimensions = [i for i in unit.dimensions if i["power"] > 0]
denominator_string = parser.name_from_dimensions(denominator_dimensions, lang)
plural_denominator_string = load.pluralize(denominator_string)
if denominator_string:
plural_denominator_string = load.pluralize(denominator_string)
else:
# in case the denominator is empty, its plural is, too
plural_denominator_string = denominator_string
unit_string = unit.name.replace(denominator_string, plural_denominator_string)
return unit_string
3 changes: 2 additions & 1 deletion quantulum3/tests/test_hypothesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import unittest

from hypothesis import given, settings
from hypothesis import example, given, settings
from hypothesis import strategies as st

from .. import parser as p
Expand All @@ -30,6 +30,7 @@ def test_extract_spellout_values(self, s, lang):
p.extract_spellout_values(s, lang=lang)

@given(st.text(), multilang_strategy)
@example("0/B", "en_US")
@settings(deadline=None)
def test_inline_parse_and_expand(self, s, lang):
# Just assert that this does not throw any exceptions
Expand Down

0 comments on commit d08adba

Please sign in to comment.