From 8fb3c396c7da49067a6092927e91012d7cf1f11b Mon Sep 17 00:00:00 2001 From: xi Date: Sun, 18 Nov 2007 00:47:32 +0000 Subject: [PATCH] A single dot is not a float value (fixes #62). git-svn-id: http://svn.pyyaml.org/pyyaml/trunk@260 18f92427-320e-0410-9341-c67f048884a3 --- lib/yaml/resolver.py | 3 ++- tests/test_errors.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/yaml/resolver.py b/lib/yaml/resolver.py index 5cbf6b3..60c43e3 100644 --- a/lib/yaml/resolver.py +++ b/lib/yaml/resolver.py @@ -173,7 +173,8 @@ Resolver.add_implicit_resolver( Resolver.add_implicit_resolver( u'tag:yaml.org,2002:float', - re.compile(ur'''^(?:[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*(?:[eE][-+][0-9]+)? + re.compile(ur'''^(?:[-+]?(?:[0-9][0-9_]*)\.[0-9_]*(?:[eE][-+][0-9]+)? + |\.[0-9_]+(?:[eE][-+][0-9]+)? |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]* |[-+]?\.(?:inf|Inf|INF) |\.(?:nan|NaN|NAN))$''', re.X), diff --git a/tests/test_errors.py b/tests/test_errors.py index a678f2b..7d6e0d2 100644 --- a/tests/test_errors.py +++ b/tests/test_errors.py @@ -17,7 +17,7 @@ class TestErrors(test_appliance.TestAppliance): self.failUnlessRaises(YAMLError, lambda: self._load_string(invalid_filename)) def _testLoaderSingleErrors(self, test_name, invalid_filename): - self._load_single(invalid_filename) + #self._load_single(invalid_filename) self.failUnlessRaises(YAMLError, lambda: self._load_single(invalid_filename)) def _testEmitterErrors(self, test_name, invalid_filename): -- 2.11.4.GIT