コード例 #1
0
ファイル: bikefacade.py プロジェクト: unnch/spell-sat
 def extractLocalVariable(self, filename_path, begin_line, begin_col,
                          end_line, end_col, variablename):
     filename_path = self.normalizeFilename(filename_path)
     extractVariable.extractLocalVariable(filename_path,
                                          coords(begin_line, begin_col),
                                          coords(end_line, end_col),
                                          variablename)
コード例 #2
0
ファイル: bikefacade.py プロジェクト: seciltabur/spell-sat
 def extractLocalVariable(self,filename_path, begin_line, begin_col,
                          end_line, end_col, variablename):
     filename_path = self.normalizeFilename(filename_path)
     extractVariable.extractLocalVariable(filename_path,
                                          coords(begin_line, begin_col),
                                          coords(end_line, end_col),
                                          variablename)
コード例 #3
0
ファイル: test_extractVariable.py プロジェクト: lebauce/artub
 def test_worksIfCoordsTheWrongWayRound(self):
     srcBefore=trimLines("""
     def foo():
         print 3 + 2
     """)
     srcAfter=trimLines("""
     def foo():
         a = 3 + 2
         print a
     """)
     writeFile(tmpfile,srcBefore)
     extractLocalVariable(tmpfile,coords(2,15),coords(2,10),'a')
     self.assertEqual(srcAfter,getQueuedFileContents(tmpfile))
コード例 #4
0
 def test_worksOnSimpleCase(self):
     srcBefore=trimLines("""
     def foo():
         print 3 + 2
     """)
     srcAfter=trimLines("""
     def foo():
         a = 3 + 2
         print a
     """)
     sourcenode = createAST(srcBefore)
     extractLocalVariable(tmpfile,coords(2,10),coords(2,15),'a')
     self.assertEqual(sourcenode.getSource(),srcAfter)
コード例 #5
0
 def test_worksIfCoordsTheWrongWayRound(self):
     srcBefore = trimLines("""
     def foo():
         print 3 + 2
     """)
     srcAfter = trimLines("""
     def foo():
         a = 3 + 2
         print a
     """)
     writeFile(tmpfile, srcBefore)
     extractLocalVariable(tmpfile, coords(2, 15), coords(2, 10), 'a')
     self.assertEqual(srcAfter, getQueuedFileContents(tmpfile))
コード例 #6
0
 def test_worksOnSimpleCase(self):
     srcBefore = trimLines("""
     def foo():
         print 3 + 2
     """)
     srcAfter = trimLines("""
     def foo():
         a = 3 + 2
         print a
     """)
     sourcenode = createAST(srcBefore)
     extractLocalVariable(tmpfile, coords(2, 10), coords(2, 15), 'a')
     self.assertEqual(sourcenode.getSource(), srcAfter)