# Path: nbdiff/diff.py
# def diff(before, after, check_modified=False):
#     """Diff two sequences of comparable objects.
# 
#     The result of this function is a list of dictionaries containing
#     values in ``before`` or ``after`` with a ``state`` of either
#     'unchanged', 'added', 'deleted', or 'modified'.
# 
#     >>> import pprint
#     >>> result = diff(['a', 'b', 'c'], ['b', 'c', 'd'])
#     >>> pprint.pprint(result)
#     [{'state': 'deleted', 'value': 'a'},
#      {'state': 'unchanged', 'value': 'b'},
#      {'state': 'unchanged', 'value': 'c'},
#      {'state': 'added', 'value': 'd'}]
# 
#     Parameters
#     ----------
#     before : iterable
#         An iterable containing values to be used as the baseline version.
#     after : iterable
#         An iterable containing values to be compared against the baseline.
#     check_modified : bool
#         Whether or not to check for modifiedness.
# 
#     Returns
#     -------
#     diff_items : A list of dictionaries containing diff information.
#     """
# 
#     # The grid will be empty if `before` or `after` are
#     # empty; this will violate the assumptions made in the rest
#     # of this function.
#     # If this is the case, we know what the result of the diff is
#     # anyways: the contents of the other, non-empty input.
#     if len(before) == 0:
#         return [
#             {'state': 'added', 'value': v}
#             for v in after
#         ]
#     elif len(after) == 0:
#         return [
#             {'state': 'deleted', 'value': v}
#             for v in before
#         ]
# 
#     grid = create_grid(before, after)
# 
#     nrows = len(grid[0])
#     ncols = len(grid)
#     dps = diff_points(grid)
#     result = []
#     for kind, col, row in dps:
#         if kind == 'unchanged':
#             value = before[col]
#             result.append({
#                 'state': kind,
#                 'value': value,
#             })
#         elif kind == 'deleted':
#             assert col < ncols
#             value = before[col]
#             result.append({
#                 'state': kind,
#                 'value': value,
#             })
#         elif kind == 'added':
#             assert row < nrows
#             value = after[row]
#             result.append({
#                 'state': kind,
#                 'value': value,
#             })
#         elif check_modified and kind == 'modified':
#             result.append({
#                 'state': kind,
#                 'originalvalue': before[col],
#                 'modifiedvalue': after[row],
#             })
#         elif (not check_modified) and kind == 'modified':
#             result.append({
#                 'state': 'deleted',
#                 'value': before[col],
#             })
#             result.append({
#                 'state': 'added',
#                 'value': after[row],
#             })
#         else:
#             raise Exception('We should not be here.')
#     return result


from nose.tools import eq_
from nbdiff.diff import diff
import json
'''
This is an example of a python test
that compares a diff function (in this case
a hardcoded one that doesn't work) to the
reference JSON to check compliance.
'''



def test_diffs():
    test_cases = json.load(open('test_cases_simple.json'))
    for test_case in test_cases:
        def gentest():

# Path: nbdiff/diff.py
# def diff(before, after, check_modified=False):
#     """Diff two sequences of comparable objects.
# 
#     The result of this function is a list of dictionaries containing
#     values in ``before`` or ``after`` with a ``state`` of either
#     'unchanged', 'added', 'deleted', or 'modified'.
# 
#     >>> import pprint
#     >>> result = diff(['a', 'b', 'c'], ['b', 'c', 'd'])
#     >>> pprint.pprint(result)
#     [{'state': 'deleted', 'value': 'a'},
#      {'state': 'unchanged', 'value': 'b'},
#      {'state': 'unchanged', 'value': 'c'},
#      {'state': 'added', 'value': 'd'}]
# 
#     Parameters
#     ----------
#     before : iterable
#         An iterable containing values to be used as the baseline version.
#     after : iterable
#         An iterable containing values to be compared against the baseline.
#     check_modified : bool
#         Whether or not to check for modifiedness.
# 
#     Returns
#     -------
#     diff_items : A list of dictionaries containing diff information.
#     """
# 
#     # The grid will be empty if `before` or `after` are
#     # empty; this will violate the assumptions made in the rest
#     # of this function.
#     # If this is the case, we know what the result of the diff is
#     # anyways: the contents of the other, non-empty input.
#     if len(before) == 0:
#         return [
#             {'state': 'added', 'value': v}
#             for v in after
#         ]
#     elif len(after) == 0:
#         return [
#             {'state': 'deleted', 'value': v}
#             for v in before
#         ]
# 
#     grid = create_grid(before, after)
# 
#     nrows = len(grid[0])
#     ncols = len(grid)
#     dps = diff_points(grid)
#     result = []
#     for kind, col, row in dps:
#         if kind == 'unchanged':
#             value = before[col]
#             result.append({
#                 'state': kind,
#                 'value': value,
#             })
#         elif kind == 'deleted':
#             assert col < ncols
#             value = before[col]
#             result.append({
#                 'state': kind,
#                 'value': value,
#             })
#         elif kind == 'added':
#             assert row < nrows
#             value = after[row]
#             result.append({
#                 'state': kind,
#                 'value': value,
#             })
#         elif check_modified and kind == 'modified':
#             result.append({
#                 'state': kind,
#                 'originalvalue': before[col],
#                 'modifiedvalue': after[row],
#             })
#         elif (not check_modified) and kind == 'modified':
#             result.append({
#                 'state': 'deleted',
#                 'value': before[col],
#             })
#             result.append({
#                 'state': 'added',
#                 'value': after[row],
#             })
#         else:
#             raise Exception('We should not be here.')
#     return result


# Path: specs/test_specs.py
from nose.tools import eq_
from nbdiff.diff import diff
import json

'''
This is an example of a python test
that compares a diff function (in this case
a hardcoded one that doesn't work) to the
reference JSON to check compliance.
'''



def test_diffs():
    test_cases = json.load(open('test_cases_simple.json'))
    for test_case in test_cases:
        def gentest():

            result = diff(test_case['before'], test_case['after'])