You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yamllint/tests
Adrien Vergé 1b378ed5b9 quoted-strings: Fix explicit octal recognition
PyYAML implements YAML spec version 1.1, not 1.2. Hence, values starting
with `0o` are not considered as numbers: they are just strings, so they
need quotes when `quoted-strings: {required: true}`.

>>> import yaml
>>> yaml.resolver.Resolver().resolve(yaml.nodes.ScalarNode, '100', (True, False))
'tag:yaml.org,2002:int'
>>> yaml.resolver.Resolver().resolve(yaml.nodes.ScalarNode, '0100', (True, False))
'tag:yaml.org,2002:int'
>>> yaml.resolver.Resolver().resolve(yaml.nodes.ScalarNode, '0o100', (True, False))
'tag:yaml.org,2002:str'

Let's try to prevent that.

Fixes https://github.com/adrienverge/yamllint/issues/351.
4 years ago
..
rules quoted-strings: Fix explicit octal recognition 4 years ago
yaml-1.2-spec-examples Tests: Remove ghost character from YAML spec example 9 years ago
__init__.py Tests: Run with LC_ALL=C for uniform tests 9 years ago
common.py CI: Add build environment without UTF-8 locales to travis-ci 5 years ago
test_cli.py End support for Python 2 4 years ago
test_config.py End support for Python 2 4 years ago
test_linter.py Drop support for EOL Python 2.6 6 years ago
test_module.py End support for Python 2 4 years ago
test_parser.py Upgrade unit tests to use more useful asserts 6 years ago
test_spec_examples.py Remove redundant parentheses 6 years ago
test_syntax_errors.py Rules: indentation: Handle sets 9 years ago
test_yamllint_directives.py directives: Fix DOS lines messing with rule IDs 4 years ago