def test_create_grid(): A = "abcabba" B = "cbabac" expected = [ # c b a b a c [False, False, True, False, True, False], # a [False, True, False, True, False, False], # b [True, False, False, False, False, True], # c [False, False, True, False, True, False], # a [False, True, False, True, False, False], # b [False, True, False, True, False, False], # b [False, False, True, False, True, False] # a ] grid = create_grid(A, B) eq_(grid, expected) A, B = ("cabcdef", "abdef") grid = create_grid(A, B) assert len([True for col in grid if len(col) == 0]) == 0
def test_diff_points(): A = [u'x = [1,3,3]\n', u'z = {1, 2, 3} \n', u'\n', u'z'] B = [u'x = [1,3,4]\n', u'z = {1, 2, 3} \n', u'\n', u'm'] grid = create_grid(A, B) result = diff_points(grid) expected = [ ('deleted', 0, None), ('added', None, 0), ('unchanged', 1, 1), ('unchanged', 2, 2), ('deleted', 3, None), ('added', None, 3), ] eq_(result, expected)