Skip to content

Commit

Permalink
Improve test coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Kundert authored and Ken Kundert committed Jun 25, 2017
1 parent 12a6c1a commit 8136f59
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Install with::

pip3 install quantiphy

Requires Python3.4 or better. Python2.7 is also supported, however support for
Requires Python3.3 or better. Python2.7 is also supported, however support for
unicode is weak.

You use *Quantity* to convert numbers and units in various forms to quantities:
Expand Down
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Install with::

pip3 install quantiphy

Requires Python3.4 or better. Python2.7 is also supported, however support for
Requires Python3.3 or better. Python2.7 is also supported, however support for
unicode is weak.

You use *Quantity* to convert numbers and units in various forms to quantities:
Expand Down
2 changes: 1 addition & 1 deletion quantiphy.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def _initialize_recognizers(cls):
unknown_sf = set(input_sf) - set(known_sf)
if unknown_sf:
unknown_sf = ', '.join(sorted(unknown_sf))
raise ValueError('Unknown scale factors: %s.' % unknown_sf)
raise ValueError('%s: unknown scale factors.' % unknown_sf)

# components {{{3
sign = named_regex('sign', '[-+]?')
Expand Down
4 changes: 3 additions & 1 deletion test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ class Foo(Quantity):
assert Quantity('10m').render(show_si=False) == '10_m'
Quantity.set_preferences(input_sf=None, unity_sf='_')
assert Quantity('10m').render(show_si=False) == '10e-3'
Quantity.set_preferences(unity_sf=None, spacer=None)
with pytest.raises(ValueError, message='q, w: unknown scale factors'):
Quantity.set_preferences(input_sf='GMkwq', unity_sf='_', spacer='')
Quantity.set_preferences(input_sf=None, unity_sf=None, spacer=None)

# test map_sf
Quantity.set_preferences(map_sf=Quantity.map_sf_to_greek)
Expand Down

0 comments on commit 8136f59

Please sign in to comment.