Require Python 3 for neg? and pos? type tests
Python 2 allows 2 < "hello" and the like.
This commit is contained in:
parent
cd1d12565d
commit
0eb4076768
@ -19,6 +19,8 @@
|
|||||||
;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
;; DEALINGS IN THE SOFTWARE.
|
;; DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
(import [hy._compat [PY3]])
|
||||||
|
|
||||||
;;;; some simple helpers
|
;;;; some simple helpers
|
||||||
|
|
||||||
(defn assert-true [x]
|
(defn assert-true [x]
|
||||||
@ -389,7 +391,8 @@
|
|||||||
(assert-true (neg? -2))
|
(assert-true (neg? -2))
|
||||||
(assert-false (neg? 1))
|
(assert-false (neg? 1))
|
||||||
(assert-false (neg? 0))
|
(assert-false (neg? 0))
|
||||||
(assert-requires-num neg?))
|
(when PY3
|
||||||
|
(assert-requires-num neg?)))
|
||||||
|
|
||||||
(defn test-zero []
|
(defn test-zero []
|
||||||
"NATIVE: testing the zero? function"
|
"NATIVE: testing the zero? function"
|
||||||
@ -479,7 +482,8 @@
|
|||||||
(assert-true (pos? 2))
|
(assert-true (pos? 2))
|
||||||
(assert-false (pos? -1))
|
(assert-false (pos? -1))
|
||||||
(assert-false (pos? 0))
|
(assert-false (pos? 0))
|
||||||
(assert-requires-num pos?))
|
(when PY3
|
||||||
|
(assert-requires-num pos?)))
|
||||||
|
|
||||||
(defn test-remove []
|
(defn test-remove []
|
||||||
"NATIVE: testing the remove function"
|
"NATIVE: testing the remove function"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user