revert yield-from test
Yield-from was introduced in 3.3, so we have to catch the compile error that's raise in 3.2. :(
This commit is contained in:
parent
a2f917aba3
commit
b56a03750f
@ -1,6 +1,3 @@
|
||||
(import [hy._compat [PY33]])
|
||||
(import [hy.errors [HyCompileError]])
|
||||
|
||||
(defmacro rev [&rest body]
|
||||
"Execute the `body` statements in reverse"
|
||||
(quasiquote (do (unquote-splice (list (reversed body))))))
|
||||
|
@ -1,13 +1,25 @@
|
||||
;; Tests where the emited code relies on Python 3.
|
||||
;; Conditionally included in nosetests runs.
|
||||
|
||||
(import [hy._compat [PY33]])
|
||||
(import [hy.errors [HyCompileError]])
|
||||
|
||||
(defn test-yield-from []
|
||||
"NATIVE: testing yield from"
|
||||
(do (defn yield-from-test []
|
||||
|
||||
(try
|
||||
(eval
|
||||
'(do (defn yield-from-test []
|
||||
(for* [i (range 3)]
|
||||
(yield i))
|
||||
(yield-from [1 2 3]))
|
||||
(assert (= (list (yield-from-test)) [0 1 2 1 2 3]))))
|
||||
(catch [e HyCompileError]
|
||||
;; Yield-from is supported in py3.3+ only
|
||||
(assert (not PY33)))
|
||||
(else (assert PY33))))
|
||||
|
||||
|
||||
|
||||
(defn test-exception-cause []
|
||||
(try (raise ValueError :from NameError)
|
||||
|
Loading…
Reference in New Issue
Block a user