mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Fix compiler.ast.flatten function so that it works on lists.
This commit is contained in:
parent
76276177de
commit
f36947032f
3 changed files with 13 additions and 8 deletions
|
@ -1,4 +1,5 @@
|
|||
import compiler
|
||||
from compiler.ast import flatten
|
||||
import os
|
||||
import test.test_support
|
||||
import unittest
|
||||
|
@ -60,6 +61,10 @@ class CompilerTest(unittest.TestCase):
|
|||
for child in node.getChildNodes():
|
||||
self.check_lineno(child)
|
||||
|
||||
def testFlatten(self):
|
||||
self.assertEquals(flatten([1, [2]]), [1, 2])
|
||||
self.assertEquals(flatten((1, (2,))), [1, 2])
|
||||
|
||||
NOLINENO = (compiler.ast.Module, compiler.ast.Stmt, compiler.ast.Discard)
|
||||
|
||||
###############################################################################
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue