mirror of
https://github.com/hanzoai/aci.git
synced 2026-10-30 18:49:51 +00:00
28 lines
684 B
Python
28 lines
684 B
Python
from hanzo_aci.indexing.locagent.compress import get_skeleton
|
|
|
|
|
|
def test_get_skeleton_keeps_constants():
|
|
code = '''
|
|
"""this is a module"""
|
|
const = {1,2,3}
|
|
import os
|
|
class fooClass:
|
|
"""this is a class"""
|
|
def __init__(self, x):
|
|
"""initialization."""
|
|
self.x = x
|
|
def print(self):
|
|
print(self.x)
|
|
def test():
|
|
a = fooClass(3)
|
|
a.print()
|
|
'''
|
|
skeleton = get_skeleton(code, keep_constant=True)
|
|
|
|
assert 'const = {1,2,3}' in skeleton
|
|
assert 'class fooClass:' in skeleton
|
|
assert 'def __init__' in skeleton
|
|
assert 'def print' in skeleton
|
|
assert 'def test' in skeleton
|
|
assert '...' in skeleton # ensure the body is replaced
|