예제 #1
0
파일: test_block.py 프로젝트: smurn/lenatu
 def parse(self, src):
     if src not in self.cache:
         src = tools.unindent(src)
         node = ast.parse(src)
         lenatu.augment(node)
         self.cache[src] = node
     else:
         node = self.cache[src]
     return node
예제 #2
0
파일: test_tools.py 프로젝트: smurn/lenatu
 def testOneLineNoIndent(self):
     self.assertEqual("x=1", tools.unindent("x=1"))
예제 #3
0
파일: test_tools.py 프로젝트: smurn/lenatu
 def testEmptyString(self):
     self.assertEqual("", tools.unindent(""))
예제 #4
0
파일: test_tools.py 프로젝트: smurn/lenatu
 def testPartiallyIndendedComment(self):
     self.assertEqual("#comment\nx=1", tools.unindent(" #comment\n   x=1"))
예제 #5
0
파일: test_tools.py 프로젝트: smurn/lenatu
 def testIgnoreComments(self):
     self.assertEqual("#comment\nx=1", tools.unindent("#comment\n   x=1"))
예제 #6
0
파일: test_tools.py 프로젝트: smurn/lenatu
 def testIgnoreEmtptyLines(self):
     self.assertEqual("\nx=1", tools.unindent("\n   x=1"))
예제 #7
0
파일: test_tools.py 프로젝트: smurn/lenatu
 def testStructurePreservedTabs(self):
     self.assertEqual("def foo():\n  x=1", tools.unindent("\tdef foo():\n\t  x=1"))
예제 #8
0
파일: test_tools.py 프로젝트: smurn/lenatu
 def testStructurePreservedSpaces(self):
     self.assertEqual("def foo():\n  x=1", tools.unindent("  def foo():\n    x=1"))
예제 #9
0
파일: test_tools.py 프로젝트: smurn/lenatu
 def testTwoLinesMixed(self):
     self.assertEqual("x=1\ny=2", tools.unindent("\tx=1\n        y=2"))
예제 #10
0
파일: test_tools.py 프로젝트: smurn/lenatu
 def testTwoLinesTabs(self):
     self.assertEqual("x=1\ny=2", tools.unindent("\tx=1\n\ty=2"))
예제 #11
0
파일: test_tools.py 프로젝트: smurn/lenatu
 def testTwoLinesSpaces(self):
     self.assertEqual("x=1\ny=2", tools.unindent("  x=1\n  y=2"))
예제 #12
0
파일: test_tools.py 프로젝트: smurn/lenatu
 def testOneLineMix(self):
     self.assertEqual("x=1", tools.unindent(" \t \t  x=1"))