Exemplo n.º 1
0
class TestVimMock(unittest.TestCase):
    def setUp(self):
        self.vim = VimMock()

    def test_init(self):
        self.assertTrue(isinstance(self.vim.current, CurrentMock))

    def test_setup_text(self):
        self.vim.current.buffer = Mock()
        self.vim.setup_text('foobar')
        self.vim.current.buffer.setup_text.assert_called_once_with('foobar')
Exemplo n.º 2
0
class TestVimMock(unittest.TestCase):

    def setUp(self):
        self.vim = VimMock()

    def test_init(self):
        self.assertTrue(isinstance(self.vim.current, CurrentMock))

    def test_setup_text(self):
        self.vim.current.buffer = Mock()
        self.vim.setup_text('foobar')
        self.vim.current.buffer.setup_text.assert_called_once_with('foobar')
Exemplo n.º 3
0
class TestVimMock(unittest.TestCase):
    def setUp(self):
        self.vim = VimMock()

    def test_init(self):
        self.assertTrue(isinstance(self.vim.current, CurrentMock))

    def test_setup_text(self):
        self.vim.current.buffer = Mock()
        self.vim.setup_text('foobar')
        self.vim.current.buffer.setup_text.assert_called_once_with('foobar')

    def test_open_file(self):
        filepath = vimmock.mocked.__file__.replace('*.pyc', '*.py')
        self.vim.open_file(filepath)
        assert self.vim.current.buffer.name == filepath

    def test_eval(self):
        assert self.vim.eval('&encoding') == 'utf-8'
        with self.assertRaises(NotImplementedError):
            self.vim.eval(':e ~')
Exemplo n.º 4
0
def patch_vim():
    """
    Sets new ``VimMock`` instance under ``vim`` key within ``sys.modules``.
    """
    sys.modules['vim'] = VimMock()
Exemplo n.º 5
0
 def setUp(self):
     self.vim = VimMock()
Exemplo n.º 6
0
 def setUp(self):
     self.vim = VimMock()