Skip to content

Commit

Permalink
No longer accept extra characters after prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
avylove committed Aug 31, 2020
1 parent 45304c9 commit 33795ae
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
2 changes: 1 addition & 1 deletion prefixed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
r'(?P<type>\D)?$'
)
RE_PREFIX = re.compile(
r'(?P<value>[-+]?\d+\.?(?:\d+)?(?:[eE]?\d)?) ?(?P<prefix>(?:[a-zA-Z\u03bc]|\xce\xbc)i?)\D*$'
r'(?P<value>[-+]?\d+\.?(?:\d+)?(?:[eE]?\d)?) ?(?P<prefix>(?:[a-zA-Z\u03bc]|\xce\xbc)i?)$'
)

SI_PREFIXES = {
Expand Down
7 changes: 0 additions & 7 deletions tests/test_float.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,6 @@ def test_invalid_type(self):
with self.assertRaises(TypeError):
Float(3j)

def test_extra_characters(self):
"""
Units provided
"""

self.assertEqual(format(Float('3kg'), '.2h'), '3.00k')

def test_space(self):
"""
A single space between value and prefix is accepted
Expand Down

0 comments on commit 33795ae

Please sign in to comment.