Fix some coding style problems
This commit is contained in:
parent
1046cd3ac5
commit
dc607763e2
@ -21,18 +21,10 @@
|
||||
from hy.models import replace_hy_obj, wrap_value
|
||||
from hy.models.expression import HyExpression
|
||||
from hy.models.string import HyString
|
||||
from hy.models.symbol import HySymbol
|
||||
from hy.models.list import HyList
|
||||
from hy.models.integer import HyInteger
|
||||
from hy.models.float import HyFloat
|
||||
from hy.models.complex import HyComplex
|
||||
from hy.models.dict import HyDict
|
||||
from hy._compat import str_type, long_type
|
||||
|
||||
from hy.errors import HyTypeError, HyMacroExpansionError
|
||||
|
||||
from collections import defaultdict
|
||||
import sys
|
||||
|
||||
CORE_MACROS = [
|
||||
"hy.core.bootstrap",
|
||||
|
@ -38,6 +38,7 @@ class HyObject(object):
|
||||
|
||||
_wrappers = {}
|
||||
|
||||
|
||||
def wrap_value(x):
|
||||
"""Wrap `x` into the corresponding Hy type.
|
||||
|
||||
@ -64,6 +65,5 @@ def replace_hy_obj(obj, other):
|
||||
if isinstance(wrapped_obj, HyObject):
|
||||
return wrapped_obj.replace(other)
|
||||
else:
|
||||
raise TypeError("Can't replace a Hy object with a non wrappable non Hy object")
|
||||
|
||||
|
||||
raise TypeError("Can't replace a Hy object "
|
||||
"with a non wrappable non Hy object")
|
||||
|
@ -23,6 +23,7 @@ from hy._compat import long_type
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
class HyInteger(HyObject, long_type):
|
||||
"""
|
||||
Internal representation of a Hy Integer. May raise a ValueError as if
|
||||
|
@ -11,6 +11,7 @@ def test_replace_long_type():
|
||||
replaced = replace_hy_obj(long_type(0), HyInteger(13))
|
||||
assert replaced == HyInteger(0)
|
||||
|
||||
|
||||
def test_replace_string_type():
|
||||
"""Test replacing python string"""
|
||||
replaced = replace_hy_obj(str_type("foo"), HyString("bar"))
|
||||
@ -23,4 +24,3 @@ def test_replace_tuple():
|
||||
assert type(replaced) == HyList
|
||||
assert type(replaced[0]) == HyInteger
|
||||
assert replaced == HyList([HyInteger(0)])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user