# 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
# coding=utf-8

ee.Initialize()

list1 = ee.List([1, 2, 3, 4, 5])
list2 = ee.List([4, 5, 6, 7])


# helper
def assert_equal(obj, compare):
    assert obj.getInfo() == compare


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():

# 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

# coding=utf-8

ee.Initialize()

list1 = ee.List([1, 2, 3, 4, 5])
list2 = ee.List([4, 5, 6, 7])


# helper
def assert_equal(obj, compare):
    assert obj.getInfo() == compare


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})