From 9f454f0228a3e3c43056e01eeeada5fd311198f1 Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Fri, 18 May 2018 10:36:31 -0700 Subject: [PATCH] Test complex numbers in test_hy2py --- tests/resources/pydemo.hy | 3 ++- tests/test_hy2py.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/resources/pydemo.hy b/tests/resources/pydemo.hy index c283f21..27d0ee4 100644 --- a/tests/resources/pydemo.hy +++ b/tests/resources/pydemo.hy @@ -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 diff --git a/tests/test_hy2py.py b/tests/test_hy2py.py index 9080429..f63c123 100644 --- a/tests/test_hy2py.py +++ b/tests/test_hy2py.py @@ -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