view elpa/elpy-1.14.1/elpy/tests/test_support.py @ 156:c745e2cc79ee

elpy: update along with direct deps
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Mon, 27 Feb 2017 12:17:38 -0500
parents elpa/elpy-1.12.0/elpy/tests/test_support.py@55ceabc58fcc
children
line wrap: on
line source

"""Tests for elpy.tests.support. Yep, we test test code."""

import unittest

from elpy.tests.support import source_and_offset


class TestSourceAndOffset(unittest.TestCase):
    def test_should_return_source_and_offset(self):
        self.assertEqual(source_and_offset("hello, _|_world"),
                         ("hello, world", 7))

    def test_should_handle_beginning_of_string(self):
        self.assertEqual(source_and_offset("_|_hello, world"),
                         ("hello, world", 0))

    def test_should_handle_end_of_string(self):
        self.assertEqual(source_and_offset("hello, world_|_"),
                         ("hello, world", 12))