Test complex numbers in test_hy2py

This commit is contained in:
Kodi Arfer 2018-05-18 10:36:31 -07:00
parent 0a5bc21fcf
commit 9f454f0228
2 changed files with 8 additions and 1 deletions

View File

@ -19,7 +19,8 @@ Call me Ishmael. Some years ago—never mind how long precisely—having little
(setv mynan NaN)
(setv pinf Inf)
(setv ninf -Inf)
;(setv mycomplex -Inf+5j) ; https://github.com/berkerpeksag/astor/issues/100
(setv mycomplex -Inf+5j)
(setv mycomplex2 NaN-Infj)
(setv num-expr (+ 3 (* 5 2) (- 6 (// 8 2)) (* (+ 1 2) (- 3 5)))) ; = 9

View File

@ -41,6 +41,12 @@ def assert_stuff(m):
assert m.pinf > 0
assert math.isinf(m.ninf)
assert m.ninf < 0
assert math.isinf(m.mycomplex.real)
assert m.mycomplex.real < 0
assert m.mycomplex.imag == 5
assert math.isnan(m.mycomplex2.real)
assert math.isinf(m.mycomplex2.imag)
assert m.mycomplex2.imag < 0
assert m.num_expr == 9