Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ exclude: |
)
repos:
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 7.0.0
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.1.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.1.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v4.4.0
rev: v6.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
Expand All @@ -26,7 +26,7 @@ repos:
- id: debug-statements
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 7.3.0
hooks:
- id: flake8
additional_dependencies:
Expand All @@ -35,7 +35,7 @@ repos:
- flake8-bugbear>=20.11.1
language_version: python3
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
rev: v1.19.1
hooks:
- id: mypy
# empty args needed in order to match mypy cli behavior
Expand Down
10 changes: 5 additions & 5 deletions _test/lib/canonical.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ def scan_tag(self):
' ': ' ',
'a': '\x07',
'b': '\x08',
'e': '\x1B',
'f': '\x0C',
'n': '\x0A',
'r': '\x0D',
'e': '\x1b',
'f': '\x0c',
'n': '\x0a',
'r': '\x0d',
't': '\x09',
'v': '\x0B',
'v': '\x0b',
'N': '\u0085',
'L': '\u2028',
'P': '\u2029',
Expand Down
6 changes: 2 additions & 4 deletions _test/lib/test_appliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,14 @@ def find_test_filenames(directory):

def parse_arguments(args):
""""""
parser = argparse.ArgumentParser(
usage=""" run the yaml tests. By default
parser = argparse.ArgumentParser(usage=""" run the yaml tests. By default
all functions on all appropriate test_files are run. Functions have
unittest attributes that determine the required extensions to filenames
that need to be available in order to run that test. E.g.\n\n
python test_yaml.py test_constructor_types\n
python test_yaml.py --verbose test_tokens spec-02-05\n\n
The presence of an extension in the .skip attribute of a function
disables the test for that function."""
)
disables the test for that function.""")
# ToDo: make into int and test > 0 in functions
parser.add_argument(
'--verbose',
Expand Down
1 change: 1 addition & 0 deletions _test/roundtrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
helper routines for testing round trip of commented YAML data
"""

import io
import sys
import textwrap
Expand Down
24 changes: 8 additions & 16 deletions _test/test_a_dedent.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,26 @@ def test_start_space_newline(self) -> None:

def test_start_no_newline(self) -> None:
# special construct to prevent stripping of following whitespac
x = dedent(
"""\
x = dedent("""\
123
456
"""
)
""")
assert x == '123\n 456\n'

def test_preserve_no_newline_at_end(self) -> None:
x = dedent(
"""
123"""
)
x = dedent("""
123""")
assert x == '123'

def test_preserve_no_newline_at_all(self) -> None:
x = dedent(
"""\
123"""
)
x = dedent("""\
123""")
assert x == '123'

def test_multiple_dedent(self) -> None:
x = dedent(
dedent(
"""
dedent("""
123
"""
),
"""),
)
assert x == '123\n'
6 changes: 2 additions & 4 deletions _test/test_add_xxx.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ def to_yaml(cls, dumper: Any, data: Any) -> Any:
style = None
return dumper.represent_scalar(cls.yaml_tag, data.logical_id, style=style)

document = dedent(
"""\
document = dedent("""\
AList:
- !Ref One
- !Ref 'Two'
Expand All @@ -180,8 +179,7 @@ def to_yaml(cls, dumper: Any, data: Any) -> Any:
CList:
- Five Six
- 'Seven Eight'
"""
)
""")
yaml = ruyaml.YAML()
yaml.preserve_quotes = True
yaml.default_flow_style = None
Expand Down
Loading
Loading