# This tests reported issues in the Promise package
from promise import Promise


def test_issue_11():
    # https://github.com/syrusakbary/promise/issues/11
    def test(x):
        def my(resolve, reject):
            if x > 0:
                resolve(x)
            else:
                reject(Exception(x))
        return Promise(my)

    promise_resolved = test(42).then(lambda x: x)
    assert promise_resolved.get() == 42

    promise_rejected = test(-42).then(lambda x: x, lambda e: str(e))
    assert promise_rejected.get() == "-42"

@@ -54,30 +54,130 @@
 rom 
-promise import Promise
+concurrent.futures import ThreadPoolExecutor%0Afrom promise import Promise%0Aexecutor = ThreadPoolExecutor(max_workers=40000);
 %0A%0A%0Ad
@@ -636,8 +636,258 @@
 = %22-42%22%0A
+%0A%0Adef identity(x):%0A    return x%0A%0A%0Adef promise_something(x):%0A    return Promise.promisify(executor.submit(identity, x));%0A%0A%0Adef test_issue_9():%0A    assert Promise.all(%5Bpromise_something(x).then(lambda y: x*y) for x in (0,1,2,3)%5D).get() == %5B0, 1, 4, 9%5D%0A

Make test for #9