Skip to content

Instantly share code, notes, and snippets.

@llimllib
Last active December 12, 2015 09:29
Show Gist options
  • Save llimllib/4752205 to your computer and use it in GitHub Desktop.
Save llimllib/4752205 to your computer and use it in GitHub Desktop.
$ python -mtopaz -e "a=[]; (:a..:b).each {|x| a<<x; a<<x.class}; puts a"
[a, Symbol, b, Symbol]
$ py.test tests/objects/test_rangeobject.py
============================================ test session starts =============================================
platform darwin -- Python 2.7.3 -- pytest-2.2.4.dev2
collected 10 items
tests/objects/test_rangeobject.py .........F
================================================== FAILURES ==================================================
_____________________________________ TestRangeObject.test_range_symbols _____________________________________
self = <tests.objects.test_rangeobject.TestRangeObject object at 0x10d496510>
space = <topaz.objspace.ObjectSpace object at 0x10d496950>
def test_range_symbols(self, space):
w_res = space.execute("""
a = []
(:a..:e).each do |x|
a << x
end
a""")
> assert self.unwrap(space, w_res) == [':a', ':b', ':c', ':d', ':e']
E assert ['a', 'b', 'c', 'd', 'e'] == [':a', ':b', ':c', ':d', ':e']
E At index 0 diff: 'a' != ':a'
tests/objects/test_rangeobject.py:79: AssertionError
===================================== 1 failed, 9 passed in 1.12 seconds =====================================
$ py.test tests/objects/test_rangeobject.py
============================================ test session starts =============================================
platform darwin -- Python 2.7.3 -- pytest-2.2.4.dev2
collected 10 items
tests/objects/test_rangeobject.py .........F
================================================== FAILURES ==================================================
_____________________________________ TestRangeObject.test_range_symbols _____________________________________
self = <tests.objects.test_rangeobject.TestRangeObject object at 0x10a180650>
space = <topaz.objspace.ObjectSpace object at 0x10a180a90>
def test_range_symbols(self, space):
w_res = space.execute("""
a = []
(:a..:e).each do |x|
a << x; a<< x.class
end
a
""")
> assert self.unwrap(space, w_res) == [':a', ':b', ':c', ':d', ':e']
E assert ['a', <topaz....a189610>, ...] == [':a', ':b', ':c', ':d', ':e']
E At index 0 diff: 'a' != ':a'
E Left contains more items, first extra item: <topaz.objects.classobject.W_ClassObject object at 0x10a189610>
tests/objects/test_rangeobject.py:80: AssertionError
===================================== 1 failed, 9 passed in 1.13 seconds ====================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment