summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unparse.py
diff options
context:
space:
mode:
authorBatuhan Taskaya <batuhanosmantaskaya@gmail.com>2020-05-03 17:11:51 (GMT)
committerGitHub <noreply@github.com>2020-05-03 17:11:51 (GMT)
commit493bf1cc316b0b5bd90779ecd1132878c881669e (patch)
treeb9e2d706bd6124f163d78b663208e16cccd802cd /Lib/test/test_unparse.py
parent3dd2157febae5087ca3333d24f69b6de9cbd13cd (diff)
downloadcpython-493bf1cc316b0b5bd90779ecd1132878c881669e.zip
cpython-493bf1cc316b0b5bd90779ecd1132878c881669e.tar.gz
cpython-493bf1cc316b0b5bd90779ecd1132878c881669e.tar.bz2
bpo-38870: Don't start generated output with newlines in ast.unparse (GH-19636)
Diffstat (limited to 'Lib/test/test_unparse.py')
-rw-r--r--Lib/test/test_unparse.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py
index d4089a3..2be44b2 100644
--- a/Lib/test/test_unparse.py
+++ b/Lib/test/test_unparse.py
@@ -128,19 +128,17 @@ class ASTTestCase(unittest.TestCase):
def check_invalid(self, node, raises=ValueError):
self.assertRaises(raises, ast.unparse, node)
- def get_source(self, code1, code2=None, strip=True):
+ def get_source(self, code1, code2=None):
code2 = code2 or code1
code1 = ast.unparse(ast.parse(code1))
- if strip:
- code1 = code1.strip()
return code1, code2
- def check_src_roundtrip(self, code1, code2=None, strip=True):
- code1, code2 = self.get_source(code1, code2, strip)
+ def check_src_roundtrip(self, code1, code2=None):
+ code1, code2 = self.get_source(code1, code2)
self.assertEqual(code2, code1)
- def check_src_dont_roundtrip(self, code1, code2=None, strip=True):
- code1, code2 = self.get_source(code1, code2, strip)
+ def check_src_dont_roundtrip(self, code1, code2=None):
+ code1, code2 = self.get_source(code1, code2)
self.assertNotEqual(code2, code1)
class UnparseTestCase(ASTTestCase):