diff options
author | Anthon van der Neut <anthon@mnt.org> | 2018-08-12 08:27:02 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2018-08-12 08:27:02 +0200 |
commit | 0b0cdab19e6ad83885485b4511822c9ed5c57769 (patch) | |
tree | 0aa583652105509bd11b6a012d759b0b8a75dc02 | |
parent | faca9e30b5ee86582cb7e996f963e1aee0f5f4ad (diff) | |
download | ruamel.yaml-0b0cdab19e6ad83885485b4511822c9ed5c57769.tar.gz |
fix issue #218 single + interpreted as integer under 1.2
This fix should be incorperated in 0.15.53
*When this change indeed resolves your problem, please **Close** this issue*.
*(You can do so usingthe WorkFlow pull-down (close to the top right of this page)*
-rw-r--r-- | _test/test_int.py | 7 | ||||
-rw-r--r-- | resolver.py | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/_test/test_int.py b/_test/test_int.py index 080eb54..ab53055 100644 --- a/_test/test_int.py +++ b/_test/test_int.py @@ -107,3 +107,10 @@ class TestBinHexOct: """) assert d[0] == 2147483647 assert d[1] == 9223372036854775808 + +class TestIntIssues: + def test_issue_218_single_plus_sign_is_not_int(self): + d = round_trip_load("""\ + +: 1 + """) + assert d == {'+': 1} diff --git a/resolver.py b/resolver.py index 34e3d1e..44e7b27 100644 --- a/resolver.py +++ b/resolver.py @@ -56,7 +56,7 @@ implicit_resolvers = [ u'tag:yaml.org,2002:int', RegExp(u'''^(?:[-+]?0b[0-1_]+ |[-+]?0o?[0-7_]+ - |[-+]?[0-9_]* + |[-+]?[0-9_]+ |[-+]?0x[0-9a-fA-F_]+)$''', re.X), list(u'-+0123456789')), ([(1, 1)], |