diff options
Diffstat (limited to 'tests/indent/python')
| -rw-r--r-- | tests/indent/python/aligned_indent.py | 11 | ||||
| -rw-r--r-- | tests/indent/python/basic_blocks.py | 14 | ||||
| -rw-r--r-- | tests/indent/python/basic_collections.py | 23 | ||||
| -rw-r--r-- | tests/indent/python/branches.py | 27 | ||||
| -rw-r--r-- | tests/indent/python/comprehensions.py | 25 | ||||
| -rw-r--r-- | tests/indent/python/control_flow.py | 22 | ||||
| -rw-r--r-- | tests/indent/python/hanging_indent.py | 6 | ||||
| -rw-r--r-- | tests/indent/python/join_lines.py | 8 | ||||
| -rw-r--r-- | tests/indent/python/nested_collections.py | 41 | ||||
| -rw-r--r-- | tests/indent/python/strings.py | 17 |
10 files changed, 194 insertions, 0 deletions
diff --git a/tests/indent/python/aligned_indent.py b/tests/indent/python/aligned_indent.py new file mode 100644 index 000000000..2a4b827f4 --- /dev/null +++ b/tests/indent/python/aligned_indent.py @@ -0,0 +1,11 @@ +def aligned_indent(arg1, + arg2): + pass + +aligned_indent(1, + 2) + + +aligned_indent(1, + 2 + ) diff --git a/tests/indent/python/basic_blocks.py b/tests/indent/python/basic_blocks.py new file mode 100644 index 000000000..4f36359bd --- /dev/null +++ b/tests/indent/python/basic_blocks.py @@ -0,0 +1,14 @@ +from os import ( + path, + name as OsName +) + +def foo(x): + pass + +class Foo: + def __init__(self): + pass + + def foo(self): + pass diff --git a/tests/indent/python/basic_collections.py b/tests/indent/python/basic_collections.py new file mode 100644 index 000000000..1582b9059 --- /dev/null +++ b/tests/indent/python/basic_collections.py @@ -0,0 +1,23 @@ +# list +a = [ + 1, 2, + 3 +] + +# set +b = { + 3, + 4, +} + +# dict +c = { + 'a': 'b', + 'c': 1, +} + +# tuple +d = ( + 1, + 2, +) diff --git a/tests/indent/python/branches.py b/tests/indent/python/branches.py new file mode 100644 index 000000000..7ce106bd7 --- /dev/null +++ b/tests/indent/python/branches.py @@ -0,0 +1,27 @@ +a = [ + 1, 2, 3] + +b = [ + x + 1 + for x in range(3)] + +c = [[[ + 1 +]]] + +d = [[[ + 4]]] + +e = [[ + 1], 2, 3] + +def foo(x, y): + pass + +foo( + a, + b) + +if (a and + b): + pass diff --git a/tests/indent/python/comprehensions.py b/tests/indent/python/comprehensions.py new file mode 100644 index 000000000..53c3961e1 --- /dev/null +++ b/tests/indent/python/comprehensions.py @@ -0,0 +1,25 @@ +# list +a = [ + x + 1 for x in range(3) +] + +# dict +b = { + x: x + 1 for x in range(3) +} + +# generator +c = ( + x * x for x in range(3) +) + +# set +d = { + x + x for x in range(3) +} + +# other styles +e = [ + x + 1 for x + in range(3) +] diff --git a/tests/indent/python/control_flow.py b/tests/indent/python/control_flow.py new file mode 100644 index 000000000..c8cd2541b --- /dev/null +++ b/tests/indent/python/control_flow.py @@ -0,0 +1,22 @@ +if a == a: + x = 1 +elif b: + x = 2 +else: + x = 3 + +while False: + pass + +for _ in range(3): + pass + +with open('/tmp/f', 'w') as f: + pass + +try: + pass +except: + pass +finally: + pass diff --git a/tests/indent/python/hanging_indent.py b/tests/indent/python/hanging_indent.py new file mode 100644 index 000000000..4d46ebed0 --- /dev/null +++ b/tests/indent/python/hanging_indent.py @@ -0,0 +1,6 @@ +def hanging_indent( + arg1, arg2): + pass + +hanging_indent( + 1, 2) diff --git a/tests/indent/python/join_lines.py b/tests/indent/python/join_lines.py new file mode 100644 index 000000000..491b2cc37 --- /dev/null +++ b/tests/indent/python/join_lines.py @@ -0,0 +1,8 @@ +a = 2 \ + + 2 + +b = 'hello' \ + 'world' + +c = lambda x: \ + x + 3 diff --git a/tests/indent/python/nested_collections.py b/tests/indent/python/nested_collections.py new file mode 100644 index 000000000..292a65a00 --- /dev/null +++ b/tests/indent/python/nested_collections.py @@ -0,0 +1,41 @@ +a = [ + 1, + [ + 2, + [ + 3 + ] + ] +] + +b = [ + 1, [[ + 3 + ], + ] +] + +c = [[[ + 3 +]]] + +d = { + 'a': [ + 2, 3 + ], + 'c': ( + [1, 2, 3], + [ + 2, + 4 + ], { + 6, + 8 + } + ) +} + +e = (1, 2, + 3, 4, + 5, 6 + ) diff --git a/tests/indent/python/strings.py b/tests/indent/python/strings.py new file mode 100644 index 000000000..0eb088fa6 --- /dev/null +++ b/tests/indent/python/strings.py @@ -0,0 +1,17 @@ +a = """ + String A +""" + +b = """ +String B +""" + +c = """ + String C + """ + +d = """ + String D +String D + String D + """ |
