def test_end_newlines():
    def test(source, end_pos):
        module = Parser(load_grammar(), u(source)).module
        assert module.get_code() == source
        assert module.end_pos == end_pos

    test('a', (1, 1))
    test('a\n', (2, 0))
    test('a\nb', (2, 1))
    test('a\n#comment\n', (3, 0))
    test('a\n#comment', (2, 8))
    test('a#comment', (1, 9))
    test('def a():\n pass', (2, 5))
The Python grammar explicitly needs a newline at the end. Jedi though still
dataset/ETHPy150Open davidhalter/jedi/test/test_parser/test_get_code.py/test_end_newlines