Restored 1m notation (but excluding exponential format for numbers)

This commit is contained in:
Hernan Grecco 2014-05-06 21:41:56 -03:00
parent 0c31c73508
commit 9a31a1d83a
2 changed files with 10 additions and 1 deletions

View File

@ -96,7 +96,15 @@ class TestStringProcessor(unittest.TestCase):
self._test('1.2E-24 hour', '1.2E-24*hour')
self._test('1.2E+24 hour', '1.2E+24*hour')
def names(self):
def test_joined_multiplication(self):
self._test('1hour', '1*hour')
self._test('1.hour', '1.*hour')
self._test('1.1hour', '1.1*hour')
self._test('1h', '1*h')
self._test('1.h', '1.*h')
self._test('1.1h', '1.1*h')
def test_names(self):
self._test('g_0', 'g_0')
self._test('g0', 'g0')
self._test('g', 'g')

View File

@ -389,6 +389,7 @@ _subs_re = [(r"([\w\.\-\+\*\\\^])\s+", r"\1 "), # merge multiple spaces
(r"cubic ({0})", r"\1**3"),
(r"square ({0})", r"\1**2"),
(r"sq ({0})", r"\1**2"),
(r"\b([0-9]+\.?[0-9]*)(?=[e|E][a-zA-Z]|[a-df-zA-DF-Z])", r"\1*"), # Handle numberLetter for multiplication
(r"([\w\.\-])\s+(?=\w)", r"\1*"), # Handle space for multiplication
]