# Path: pycc/asttools/parse.py
# def parse(source, filename='<unknown>', mode='exec'):
#     """An ast.parse extension.
# 
#     This function behaves identically to the standard ast.parse except that it
#     adds parent and sibling references to each node.
#     """
#     node = ast.parse(source, filename, mode)
#     references.add_parent_references(node)
#     references.add_sibling_references(node)
# 
#     return node
# 
# Path: pycc/optimizers/constant.py
# def _resolve_constant_value(name):
#     def visit_Name(self, node):
#     def visit_BinOp(self, node):
# def optimize(node):
# class ConstantInliner(visitor.NodeTransformer):


import ast
import pytest
from pycc.asttools import parse
from pycc.optimizers import constant

from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals




source = """
ONE = 1
TWO = 2
THREE = ONE + TWO
FOUR = THREE + ONE
FIVE = THREE + TWO

def return_const():
    return FOUR

def return_var():
    return FIVE

FIVE = FIVE + ONE
FIVE -= ONE
"""


@pytest.fixture
def node():
    """Get as AST node from the source."""

# Path: pycc/asttools/parse.py
# def parse(source, filename='<unknown>', mode='exec'):
#     """An ast.parse extension.
# 
#     This function behaves identically to the standard ast.parse except that it
#     adds parent and sibling references to each node.
#     """
#     node = ast.parse(source, filename, mode)
#     references.add_parent_references(node)
#     references.add_sibling_references(node)
# 
#     return node
# 
# Path: pycc/optimizers/constant.py
# def _resolve_constant_value(name):
#     def visit_Name(self, node):
#     def visit_BinOp(self, node):
# def optimize(node):
# class ConstantInliner(visitor.NodeTransformer):


# Path: tests/optimizers/test_constant_optimizer.py
import ast
import pytest
from pycc.asttools import parse
from pycc.optimizers import constant


from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals




source = """
ONE = 1
TWO = 2
THREE = ONE + TWO
FOUR = THREE + ONE
FIVE = THREE + TWO

def return_const():
    return FOUR

def return_var():
    return FIVE

FIVE = FIVE + ONE
FIVE -= ONE
"""


@pytest.fixture
def node():
    """Get as AST node from the source."""

    return parse.parse(source)