Remove tests of the old comprehension forms
This commit is contained in:
parent
cf0dafef9b
commit
14979edcab
@ -554,14 +554,6 @@ def test_attribute_empty():
|
|||||||
cant_compile('[2].foo')
|
cant_compile('[2].foo')
|
||||||
|
|
||||||
|
|
||||||
def test_invalid_list_comprehension():
|
|
||||||
"""Ensure that invalid list comprehensions do not break the compiler"""
|
|
||||||
cant_compile("(genexpr x [])")
|
|
||||||
cant_compile("(genexpr [x [1 2 3 4]] x)")
|
|
||||||
cant_compile("(list-comp None [])")
|
|
||||||
cant_compile("(list-comp [x [1 2 3]] x)")
|
|
||||||
|
|
||||||
|
|
||||||
def test_bad_setv():
|
def test_bad_setv():
|
||||||
"""Ensure setv handles error cases"""
|
"""Ensure setv handles error cases"""
|
||||||
cant_compile("(setv (a b) [1 2])")
|
cant_compile("(setv (a b) [1 2])")
|
||||||
|
@ -842,52 +842,6 @@
|
|||||||
(assert (= x 3)))
|
(assert (= x 3)))
|
||||||
|
|
||||||
|
|
||||||
(defn test-list-comprehensions []
|
|
||||||
"NATIVE: test list comprehensions"
|
|
||||||
(assert (= (list-comp (* x 2) [x (range 2)]) [0 2]))
|
|
||||||
(assert (= (list-comp (* x 2) [x (range 4)] (% x 2)) [2 6]))
|
|
||||||
(assert (= (sorted (list-comp (* y 2) [(, x y) (.items {"1" 1 "2" 2})]))
|
|
||||||
[2 4]))
|
|
||||||
(assert (= (list-comp (, x y) [x (range 2) y (range 2)])
|
|
||||||
[(, 0 0) (, 0 1) (, 1 0) (, 1 1)]))
|
|
||||||
(assert (= (list-comp j [j [1 2]]) [1 2])))
|
|
||||||
|
|
||||||
|
|
||||||
(defn test-set-comprehensions []
|
|
||||||
"NATIVE: test set comprehensions"
|
|
||||||
(assert (instance? set (set-comp x [x (range 2)])))
|
|
||||||
(assert (= (set-comp (* x 2) [x (range 2)]) (set [0 2])))
|
|
||||||
(assert (= (set-comp (* x 2) [x (range 4)] (% x 2)) (set [2 6])))
|
|
||||||
(assert (= (set-comp (* y 2) [(, x y) (.items {"1" 1 "2" 2})])
|
|
||||||
(set [2 4])))
|
|
||||||
(assert (= (set-comp (, x y) [x (range 2) y (range 2)])
|
|
||||||
(set [(, 0 0) (, 0 1) (, 1 0) (, 1 1)])))
|
|
||||||
(assert (= (set-comp j [j [1 2]]) (set [1 2]))))
|
|
||||||
|
|
||||||
|
|
||||||
(defn test-dict-comprehensions []
|
|
||||||
"NATIVE: test dict comprehensions"
|
|
||||||
(assert (instance? dict (dict-comp x x [x (range 2)])))
|
|
||||||
(assert (= (dict-comp x (* x 2) [x (range 2)]) {1 2 0 0}))
|
|
||||||
(assert (= (dict-comp x (* x 2) [x (range 4)] (% x 2)) {3 6 1 2}))
|
|
||||||
(assert (= (dict-comp x (* y 2) [(, x y) (.items {"1" 1 "2" 2})])
|
|
||||||
{"2" 4 "1" 2}))
|
|
||||||
(assert (= (dict-comp (, x y) (+ x y) [x (range 2) y (range 2)])
|
|
||||||
{(, 0 0) 0 (, 1 0) 1 (, 0 1) 1 (, 1 1) 2})))
|
|
||||||
|
|
||||||
|
|
||||||
(defn test-generator-expressions []
|
|
||||||
"NATIVE: test generator expressions"
|
|
||||||
(assert (not (instance? list (genexpr x [x (range 2)]))))
|
|
||||||
(assert (= (list (genexpr (* x 2) [x (range 2)])) [0 2]))
|
|
||||||
(assert (= (list (genexpr (* x 2) [x (range 4)] (% x 2))) [2 6]))
|
|
||||||
(assert (= (list (sorted (genexpr (* y 2) [(, x y) (.items {"1" 1 "2" 2})])))
|
|
||||||
[2 4]))
|
|
||||||
(assert (= (list (genexpr (, x y) [x (range 2) y (range 2)]))
|
|
||||||
[(, 0 0) (, 0 1) (, 1 0) (, 1 1)]))
|
|
||||||
(assert (= (list (genexpr j [j [1 2]])) [1 2])))
|
|
||||||
|
|
||||||
|
|
||||||
(defn test-defn-order []
|
(defn test-defn-order []
|
||||||
"NATIVE: test defn evaluation order"
|
"NATIVE: test defn evaluation order"
|
||||||
(setv acc [])
|
(setv acc [])
|
||||||
|
Loading…
Reference in New Issue
Block a user