mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 23:34:45 +08:00
Actually get the first few written tests passing.
This commit is contained in:
@@ -127,7 +127,7 @@ class Node(Base):
|
|||||||
__str__ = __unicode__
|
__str__ = __unicode__
|
||||||
|
|
||||||
def get_code(self):
|
def get_code(self):
|
||||||
return str(self)
|
return "".join(c.get_code() for c in self.children)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def prefix(self):
|
def prefix(self):
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from jedi.parser import pytree
|
|||||||
from jedi.parser.pgen2 import Driver
|
from jedi.parser.pgen2 import Driver
|
||||||
|
|
||||||
|
|
||||||
def test_basic():
|
def test_basic_parsing():
|
||||||
def compare(string):
|
def compare(string):
|
||||||
"""Generates the AST object and then regenerates the code."""
|
"""Generates the AST object and then regenerates the code."""
|
||||||
assert d.parse_string(string).get_code() == string
|
assert d.parse_string(string).get_code() == string
|
||||||
@@ -22,14 +22,4 @@ def test_basic():
|
|||||||
compare('wblabla* 1\t\n')
|
compare('wblabla* 1\t\n')
|
||||||
compare('def x(a, b:3): pass\n')
|
compare('def x(a, b:3): pass\n')
|
||||||
|
|
||||||
print(d)
|
|
||||||
tree = d.parse_string('wblabla* 1\t\n')
|
|
||||||
print(repr(tree))
|
|
||||||
print(tree)
|
|
||||||
#import pdb; pdb.set_trace()
|
|
||||||
print(repr(d.parse_string('def x(a, b:3): pass\n')))
|
|
||||||
print()
|
|
||||||
x = d.parse_string('\na #pass\n')
|
|
||||||
print(repr(x))
|
|
||||||
print(x.get_code())
|
|
||||||
assert False
|
assert False
|
||||||
|
|||||||
Reference in New Issue
Block a user