コード例 #1
0
ファイル: test_server.py プロジェクト: Abzalov50/emacs-state
    def test_should_support_utf8(self):
        fd, filename = tempfile.mkstemp(prefix="elpy-test-")
        self.addCleanup(os.remove, filename)
        with open(filename, "wb") as f:
            f.write(u"möp".encode("utf-8"))

        source = server.get_source({'filename': filename})

        self.assertEqual(source, u"möp")
コード例 #2
0
ファイル: test_server.py プロジェクト: Abzalov50/emacs-state
    def test_should_return_file_contents(self):
        fd, filename = tempfile.mkstemp(prefix="elpy-test-")
        self.addCleanup(os.remove, filename)
        with open(filename, "w") as f:
            f.write("file contents")

        fileobj = {'filename': filename}

        self.assertEqual(server.get_source(fileobj), "file contents")
コード例 #3
0
ファイル: test_server.py プロジェクト: Abzalov50/emacs-state
    def test_should_clean_up_tempfile(self):
        fd, filename = tempfile.mkstemp(prefix="elpy-test-")
        with open(filename, "w") as f:
            f.write("file contents")

        fileobj = {'filename': filename, 'delete_after_use': True}

        self.assertEqual(server.get_source(fileobj), "file contents")
        self.assertFalse(os.path.exists(filename))
コード例 #4
0
ファイル: test_server.py プロジェクト: Limmen/emacs-setup
    def test_should_support_utf8(self):
        fd, filename = tempfile.mkstemp(prefix="elpy-test-")
        self.addCleanup(os.remove, filename)
        with open(filename, "wb") as f:
            f.write(u"möp".encode("utf-8"))

        source = server.get_source({'filename': filename})

        self.assertEqual(source, u"möp")
コード例 #5
0
ファイル: test_server.py プロジェクト: phuoctai-huynh/config
    def test_should_clean_up_tempfile(self):
        fd, filename = tempfile.mkstemp(prefix="elpy-test-")
        with open(filename, "w") as f:
            f.write("file contents")

        fileobj = {"filename": filename, "delete_after_use": True}

        self.assertEqual(server.get_source(fileobj), "file contents")
        self.assertFalse(os.path.exists(filename))
コード例 #6
0
ファイル: test_server.py プロジェクト: phuoctai-huynh/config
    def test_should_return_file_contents(self):
        fd, filename = tempfile.mkstemp(prefix="elpy-test-")
        self.addCleanup(os.remove, filename)
        with open(filename, "w") as f:
            f.write("file contents")

        fileobj = {"filename": filename}

        self.assertEqual(server.get_source(fileobj), "file contents")
コード例 #7
0
ファイル: test_server.py プロジェクト: Abzalov50/emacs-state
 def test_should_return_string_by_default(self):
     self.assertEqual(server.get_source("foo"), "foo")
コード例 #8
0
ファイル: test_server.py プロジェクト: Limmen/emacs-setup
 def test_should_return_string_by_default(self):
     self.assertEqual(server.get_source("foo"),
                      "foo")