Skip to content

Instantly share code, notes, and snippets.

@FichteFoll
Created February 10, 2016 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FichteFoll/1c0e61b110da34a74cb5 to your computer and use it in GitHub Desktop.
Save FichteFoll/1c0e61b110da34a74cb5 to your computer and use it in GitHub Desktop.
Draft of tests for Visual Indentation
import pytest
@pytest.parametrize(
['input', 'expected_output'],
[
# Fold in before space
("""
func(a, b, c,| d, e, f)
""",
"""
func(a, b, c,
|d, e, f)
"""),
# Fold-in after space (strip?)
("""
func(a, b, c, |d, e, f)
""",
"""
func(a, b, c,
|d, e, f)
"""),
# After nested fold-in
("""
func(a, (b, c),|)
""",
"""
func(a, (b, c),
|)
"""),
# Block with content
("""
l = [|a]
""",
"""
l = [
|a
]
"""),
("""
l = [|a, b
c, d]
""",
"""
l = [
|a, b
c, d
]
"""),
# Empty block
("""
func(|)
""",
"""
func(
|
)
"""),
# block in fold-in TOREVIEW
("""
func(a, b, (|))
""",
"""
func(a, b, (
|
))
"""),
# Multiple nested fold-in brackets
("""
(DC('tagsOptions', '...'),
('tagsOptions', [('IDENT', "foreground"),|
""",
"""
(DC('tagsOptions', '...'),
('tagsOptions', [('IDENT', "foreground"),
|
"""),
("""
(DC('tagsOptions', '...'),
('tagsOptions', [('IDENT', "foreground"),|]))
""",
"""
(DC('tagsOptions', '...'),
('tagsOptions', [('IDENT', "foreground"),
|]))
"""),
("""
(DC('tagsOptions', '...'),
('tagsOptions', [('IDENT', "foreground")]|))
""",
"""
(DC('tagsOptions', '...'),
('tagsOptions', [('IDENT', "foreground")]
|))
"""),
("""
(DC('tagsOptions', '...'),
('tagsOptions', [('IDENT', "foreground")])|)
""",
"""
(DC('tagsOptions', '...'),
('tagsOptions', [('IDENT', "foreground")])
|)
"""),
# Comma-aware
("""
a(b + c, d |+)
""",
"""
a(b + c, d
|+)
"""),
# Nested comma-aware (with content)
("""
a(b, (c, d |+))
""",
"""
a(b, (c, d
|+))
"""),
# Nested comma-aware (without content or closing brackets)
("""
a(b, (c, d|
""",
"""
a(b, (c, d
|
"""),
]
)
def test_(input, expected_output):
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment