diff --git a/tests/native_tests/contrib/hy_repr.hy b/tests/native_tests/contrib/hy_repr.hy index 5085cc3..8787435 100644 --- a/tests/native_tests/contrib/hy_repr.hy +++ b/tests/native_tests/contrib/hy_repr.hy @@ -3,6 +3,7 @@ ;; license. See the LICENSE. (import + [hy._compat [PY3]] [math [isnan]] [hy.contrib.hy-repr [hy-repr hy-repr-register]]) @@ -78,6 +79,14 @@ (assert (is (type (get orig 1)) float)) (assert (is (type (get result 1)) HyFloat))) +(when PY3 (defn test-bytes-keywords [] + ; Make sure that keyword-like bytes objects aren't hy-repred as if + ; they were real keywords. + (setv kw :mykeyword) + (assert (= (hy-repr kw) ":mykeyword")) + (assert (= (hy-repr (str ':mykeyword)) ":mykeyword")) + (assert (= (hy-repr (.encode kw "UTF-8") #[[b"\xef\xb7\x90:hello"]]))))) + (defn test-hy-model-constructors [] (import hy) (assert (= (hy-repr (hy.HyInteger 7)) "'7"))