checkpoint: massive refactor
This commit is contained in:
@@ -2,8 +2,8 @@ import pytest
|
||||
from file_cache import ASTParser
|
||||
|
||||
def test_ast_parser_get_curated_view():
|
||||
parser = ASTParser("python")
|
||||
code = '''
|
||||
parser = ASTParser("python")
|
||||
code = '''
|
||||
@core_logic
|
||||
def core_func():
|
||||
"""Core logic doc."""
|
||||
@@ -25,20 +25,16 @@ class MyClass:
|
||||
def core_method(self):
|
||||
print("method preserved")
|
||||
'''
|
||||
curated = parser.get_curated_view(code)
|
||||
|
||||
# Check that core_func is preserved
|
||||
assert 'print("this should be preserved")' in curated
|
||||
assert 'return True' in curated
|
||||
|
||||
# Check that hot_func is preserved
|
||||
assert '# [HOT]' in curated
|
||||
assert 'print("this should also be preserved")' in curated
|
||||
|
||||
# Check that normal_func is stripped but docstring is preserved
|
||||
assert '"""Normal doc."""' in curated
|
||||
assert 'print("this should be stripped")' not in curated
|
||||
assert '...' in curated
|
||||
|
||||
# Check that core_method is preserved
|
||||
assert 'print("method preserved")' in curated
|
||||
curated = parser.get_curated_view(code)
|
||||
# Check that core_func is preserved
|
||||
assert 'print("this should be preserved")' in curated
|
||||
assert 'return True' in curated
|
||||
# Check that hot_func is preserved
|
||||
assert '# [HOT]' in curated
|
||||
assert 'print("this should also be preserved")' in curated
|
||||
# Check that normal_func is stripped but docstring is preserved
|
||||
assert '"""Normal doc."""' in curated
|
||||
assert 'print("this should be stripped")' not in curated
|
||||
assert '...' in curated
|
||||
# Check that core_method is preserved
|
||||
assert 'print("method preserved")' in curated
|
||||
|
||||
Reference in New Issue
Block a user