# Path: geetools/tools/ee_list.py
# def difference(eelist, to_compare):
# def format(eelist):
#     def wrap(el, ini):
# def getFromDict(eelist, values):
#     def wrap(el, first):
# def intersection(eelist, intersect):
#     def wrap(element, first):
# def removeDuplicates(eelist):
#     def wrap(element, init):
# def removeIndex(list, index):
#     def allowed():
#         def zerof(list):
#         def rest(list, index):
#             def lastf(list):
#             def restf(list, index):
# def replaceDict(eelist, to_replace):
#     def wrap(el):
# def sequence(ini, end, step=1):
# def toString(eelist):
#     def wrap(el):
#         def false(el):
# def zip(eelist):
#     def wrap(l, accum):
# def transpose(eelist):
#     def wrap(i, acc):
#         def wrap2(ll, accum):


from geetools.tools import ee_list
import ee
def test_list_intersection():
    intersection = ee_list.intersection(list1, list2)
    assert_equal(intersection, [4, 5])


def test_list_difference():
    diff = ee_list.difference(list1, list2)
    assert_equal(diff, [1, 2, 3, 6, 7])


def test_remove_duplicates():
    duplicated = ee.List([1, 2, 2, 1, 3, 5])
    unique = ee_list.removeDuplicates(duplicated)
    assert_equal(unique, [1, 2, 3, 5])


def test_replace_many():
    replaced = ee_list.replaceDict(list1, {1: 'test', 4:8})
    assert_equal(replaced, ['test', 2, 3, 8, 5])

    # new test to match image's test
    newlist = ee.List(["B1", "B2", "B3", "B4", "B5", "B6", "B7",
                        "cfmask", "cfmask_conf"])
    replaced = ee_list.replaceDict(newlist, {'B1': 'BLUE', 'B2': 'GREEN'})
    assert_equal(replaced, ["BLUE", "GREEN", "B3", "B4", "B5", "B6", "B7",
                            "cfmask", "cfmask_conf"])


def test_get_from_dict():
    test_list = ee.List(['a', 'c'])

# Path: geetools/tools/ee_list.py
# def difference(eelist, to_compare):
# def format(eelist):
#     def wrap(el, ini):
# def getFromDict(eelist, values):
#     def wrap(el, first):
# def intersection(eelist, intersect):
#     def wrap(element, first):
# def removeDuplicates(eelist):
#     def wrap(element, init):
# def removeIndex(list, index):
#     def allowed():
#         def zerof(list):
#         def rest(list, index):
#             def lastf(list):
#             def restf(list, index):
# def replaceDict(eelist, to_replace):
#     def wrap(el):
# def sequence(ini, end, step=1):
# def toString(eelist):
#     def wrap(el):
#         def false(el):
# def zip(eelist):
#     def wrap(l, accum):
# def transpose(eelist):
#     def wrap(i, acc):
#         def wrap2(ll, accum):


# Path: tests/test_ee_list.py
from geetools.tools import ee_list
import ee

def test_list_intersection():
    intersection = ee_list.intersection(list1, list2)
    assert_equal(intersection, [4, 5])


def test_list_difference():
    diff = ee_list.difference(list1, list2)
    assert_equal(diff, [1, 2, 3, 6, 7])


def test_remove_duplicates():
    duplicated = ee.List([1, 2, 2, 1, 3, 5])
    unique = ee_list.removeDuplicates(duplicated)
    assert_equal(unique, [1, 2, 3, 5])


def test_replace_many():
    replaced = ee_list.replaceDict(list1, {1: 'test', 4:8})
    assert_equal(replaced, ['test', 2, 3, 8, 5])

    # new test to match image's test
    newlist = ee.List(["B1", "B2", "B3", "B4", "B5", "B6", "B7",
                        "cfmask", "cfmask_conf"])
    replaced = ee_list.replaceDict(newlist, {'B1': 'BLUE', 'B2': 'GREEN'})
    assert_equal(replaced, ["BLUE", "GREEN", "B3", "B4", "B5", "B6", "B7",
                            "cfmask", "cfmask_conf"])


def test_get_from_dict():
    test_list = ee.List(['a', 'c'])

    test_dict = ee.Dictionary({'a':1, 'b':5, 'c':8})