Skip to content

Commit

Permalink
Add more tests for fancy whitespace (#2147)
Browse files Browse the repository at this point in the history
  • Loading branch information
ambv authored Apr 26, 2021
1 parent 557b54a commit eaa337f
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

- Fix crash on docstrings ending with "\ ". (#2142)

- Fix crash when atypical whitespace is cleaned out of dostrings (#2120)

- Reflect the `--skip-magic-trailing-comma` and `--experimental-string-processing` flags
in the name of the cache file. Without this fix, changes in these flags would not take
effect if the cache had already been populated. (#2131)
Expand Down
28 changes: 28 additions & 0 deletions tests/data/docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,20 @@ def multiline_backslash_2():
hey there \ '''


def multiline_backslash_3():
'''
already escaped \\ '''


def my_god_its_full_of_stars_1():
"I'm sorry Dave\u2001"


# the space below is actually a \u2001, removed in output
def my_god_its_full_of_stars_2():
"I'm sorry Dave "


# output

class MyClass:
Expand Down Expand Up @@ -347,3 +361,17 @@ def multiline_backslash_1():
def multiline_backslash_2():
"""
hey there \ """


def multiline_backslash_3():
"""
already escaped \\"""


def my_god_its_full_of_stars_1():
"I'm sorry Dave\u2001"


# the space below is actually a \u2001, removed in output
def my_god_its_full_of_stars_2():
"I'm sorry Dave"
40 changes: 40 additions & 0 deletions tests/data/docstring_no_string_normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,26 @@ def shockingly_the_quotes_are_normalized_v2():
'''
pass


def backslash_space():
'\ '


def multiline_backslash_1():
'''
hey\there\
\ '''


def multiline_backslash_2():
'''
hey there \ '''


def multiline_backslash_3():
'''
already escaped \\ '''

# output

class ALonelyClass:
Expand Down Expand Up @@ -207,3 +227,23 @@ def shockingly_the_quotes_are_normalized_v2():
Docstring Docstring Docstring
'''
pass


def backslash_space():
'\ '


def multiline_backslash_1():
'''
hey\there\
\ '''


def multiline_backslash_2():
'''
hey there \ '''


def multiline_backslash_3():
'''
already escaped \\'''

0 comments on commit eaa337f

Please sign in to comment.