parent
2ef9a0fdaf
commit
b7f92bd915
@ -67,10 +67,11 @@ def _resolve_atom(obj):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
if obj != "j":
|
||||||
return HyComplex(obj)
|
try:
|
||||||
except ValueError:
|
return HyComplex(obj)
|
||||||
pass
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
table = {
|
table = {
|
||||||
"true": "True",
|
"true": "True",
|
||||||
|
@ -230,3 +230,12 @@ def test_hashbang():
|
|||||||
""" Ensure we can escape things """
|
""" Ensure we can escape things """
|
||||||
entry = tokenize("#!this is a comment\n")
|
entry = tokenize("#!this is a comment\n")
|
||||||
assert entry == []
|
assert entry == []
|
||||||
|
|
||||||
|
|
||||||
|
def test_complex():
|
||||||
|
"""Ensure we tokenize complex numbers properly"""
|
||||||
|
# This is a regression test for #143
|
||||||
|
entry = tokenize("(1j)")[0][0]
|
||||||
|
assert entry == HyComplex("1.0j")
|
||||||
|
entry = tokenize("(j)")[0][0]
|
||||||
|
assert entry == HySymbol("j")
|
||||||
|
@ -420,7 +420,8 @@
|
|||||||
(assert (= (sorted (list-comp (* y 2) ((, x y) (.items {"1" 1 "2" 2}))))
|
(assert (= (sorted (list-comp (* y 2) ((, x y) (.items {"1" 1 "2" 2}))))
|
||||||
[2 4]))
|
[2 4]))
|
||||||
(assert (= (list-comp (, x y) (x (range 2) y (range 2)))
|
(assert (= (list-comp (, x y) (x (range 2) y (range 2)))
|
||||||
[(, 0 0) (, 0 1) (, 1 0) (, 1 1)])))
|
[(, 0 0) (, 0 1) (, 1 0) (, 1 1)]))
|
||||||
|
(assert (= (list-comp j (j [1 2])) [1 2])))
|
||||||
|
|
||||||
|
|
||||||
(defn test-defn-order []
|
(defn test-defn-order []
|
||||||
|
Loading…
Reference in New Issue
Block a user