diff --git a/hy/models/list.py b/hy/models/list.py index 183ec42..de2de0b 100644 --- a/hy/models/list.py +++ b/hy/models/list.py @@ -33,5 +33,8 @@ class HyList(HyObject, list): HyObject.replace(self, other) return self + def __add__(self, other): + return self.__class__(super(HyList, self).__add__(other)) + def __repr__(self): return "[%s]" % (" ".join([str(x) for x in self])) diff --git a/tests/models/__init__.py b/tests/models/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/models/test_list.py b/tests/models/test_list.py new file mode 100644 index 0000000..f403802 --- /dev/null +++ b/tests/models/test_list.py @@ -0,0 +1,9 @@ +from hy.models.list import HyList + + +def test_list_add(): + a = HyList([1, 2, 3]) + b = HyList([3, 4, 5]) + c = a + b + assert c == [1, 2, 3, 3, 4, 5] + assert c.__class__ == HyList