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")
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
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")
def setUp(self): self.buffer = models.Buffer() with open(fixtures.get("basic_python.py"), 'r') as f: self.buffer.document.read(f)
def setUp(self): self.buffer = models.Buffer() with open(fixtures.get("20_lines.txt"), 'r') as f: self.buffer.document.read(f)