From 14979edcab424d75005d93ce7d5811ba21abbd26 Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Thu, 7 Jun 2018 12:20:23 -0700 Subject: [PATCH] Remove tests of the old comprehension forms --- tests/compilers/test_ast.py | 8 ------ tests/native_tests/language.hy | 46 ---------------------------------- 2 files changed, 54 deletions(-) diff --git a/tests/compilers/test_ast.py b/tests/compilers/test_ast.py index ad41b01..bbf964a 100644 --- a/tests/compilers/test_ast.py +++ b/tests/compilers/test_ast.py @@ -554,14 +554,6 @@ def test_attribute_empty(): 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(): """Ensure setv handles error cases""" cant_compile("(setv (a b) [1 2])") diff --git a/tests/native_tests/language.hy b/tests/native_tests/language.hy index 9ce8da2..37f4d4d 100644 --- a/tests/native_tests/language.hy +++ b/tests/native_tests/language.hy @@ -842,52 +842,6 @@ (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 [] "NATIVE: test defn evaluation order" (setv acc [])