Skip to content
Permalink
Browse files

Fix test, because we only accept comma for compatible locales

  • Loading branch information
elpaso committed Jun 9, 2018
1 parent bf810e9 commit cb3eb961381ff1060076d6b991b43c01815b561c
Showing with 10 additions and 5 deletions.
  1. +10 −5 tests/src/python/test_qgsfieldvalidator.py
@@ -59,21 +59,26 @@ def _test(value, expected):

# Valid
_test('0.1234', QValidator.Acceptable)
_test('0,1234', QValidator.Acceptable)

# Apparently we accept comma only when locale say so
if DECIMAL_SEPARATOR != '.':
_test('0,1234', QValidator.Acceptable)

# If precision is > 0, regexp validator is used (and it does not support sci notation)
if field.precision() == 0:
_test('12345.1234e+123', QValidator.Acceptable)
_test('12345.1234e-123', QValidator.Acceptable)
_test('12345,1234e+123', QValidator.Acceptable)
_test('12345,1234e-123', QValidator.Acceptable)
if DECIMAL_SEPARATOR != '.':
_test('12345,1234e+123', QValidator.Acceptable)
_test('12345,1234e-123', QValidator.Acceptable)
_test('', QValidator.Acceptable)

# Out of range
_test('12345.1234e+823', QValidator.Intermediate)
_test('12345.1234e-823', QValidator.Intermediate)
_test('12345,1234e+823', QValidator.Intermediate)
_test('12345,1234e-823', QValidator.Intermediate)
if DECIMAL_SEPARATOR != '.':
_test('12345,1234e+823', QValidator.Intermediate)
_test('12345,1234e-823', QValidator.Intermediate)

# Invalid
_test('12345-1234', QValidator.Invalid)

0 comments on commit cb3eb96

Please sign in to comment.
You can’t perform that action at this time.