Exemplo n.º 1
0
 def testDeleteToEndOfWordCommand(self):
     self.buffer = models.Buffer()
     with open(fixtures.get("basic_python.py"), 'r') as f:
         self.buffer.document.read(f)
     self.buffer.cursor.toPos((1, 6))
     command = commands.DeleteToEndOfWordCommand(self.buffer)
     result = command.execute()
     self.assertEqual(self.buffer.cursor.pos, (1, 6))
     self.assertEqual(self.buffer.document.lineText(1), "#!pyt\n")
Exemplo n.º 2
0
def buffer(name):
    """
    Creates and returns a fully initialized buffer from a given fixture name
    """
    buf = models.Buffer()
    with open(get(name), "r") as f:
        buf.document.read(f)
    buf.document.documentMetaInfo("Filename").setData(name)
    return buf
Exemplo n.º 3
0
 def testParenthesisPreserved(self):
     """Check if parentheses are preserved (#124)"""
     self.buffer = models.Buffer()
     with open(fixtures.get("issue_124"), 'r') as f:
         self.buffer.document.read(f)
     self.buffer.cursor.toPos((1, 6))
     command = commands.DeleteToEndOfWordCommand(self.buffer)
     result = command.execute()
     self.assertEqual(self.buffer.cursor.pos, (1, 6))
     self.assertEqual(self.buffer.document.lineText(1),
                      "def f(bar, baz):\n")
Exemplo n.º 4
0
 def setUp(self):
     self.buffer = models.Buffer()
     with open(fixtures.get("basic_python.py"), 'r') as f:
         self.buffer.document.read(f)
Exemplo n.º 5
0
    def setUp(self):
        self.buffer = models.Buffer()

        with open(fixtures.get("20_lines.txt"), 'r') as f:
            self.buffer.document.read(f)