summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth M Morton <seth.m.morton@gmail.com>2016-03-09 16:53:09 -0800
committerSeth M Morton <seth.m.morton@gmail.com>2016-03-09 16:53:09 -0800
commitf3dc48a8fbaf07707abb453727c45e470d699783 (patch)
tree3c93d8153e5495feeb9ff60b635e7e3554d63085
parent3e224bbd83dc3dd1a497b2b1b66340529f77fd8e (diff)
downloadnatsort-f3dc48a8fbaf07707abb453727c45e470d699783.tar.gz
Fixed bug in float_splitter test function.
-rw-r--r--test_natsort/slow_splitters.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/test_natsort/slow_splitters.py b/test_natsort/slow_splitters.py
index c7a3cd9..c55b103 100644
--- a/test_natsort/slow_splitters.py
+++ b/test_natsort/slow_splitters.py
@@ -106,8 +106,17 @@ def float_splitter(x, signed, exp, safe, sep):
full_list.append(''.join(strings))
strings = []
# If this is an exponent, add to the number list.
+ elif (i > 0 and i + 2 < input_len and exp and char in 'eE' and
+ x[i-1] in all_digits and x[i+1] in set('+-') and
+ x[i+2] in all_digits):
+ if 'e' in nums or 'E' in nums:
+ strings = [char]
+ full_list.append(float(''.join(nums)))
+ nums = []
+ else:
+ nums.append(char)
elif (i > 0 and i + 1 < input_len and exp and char in 'eE' and
- x[i-1] in all_digits and x[i+1] in all_digits | set('+-')):
+ x[i-1] in all_digits and x[i+1] in all_digits):
if 'e' in nums or 'E' in nums:
strings = [char]
full_list.append(float(''.join(nums)))