88from unification import unify , reify , var
99
1010from cons import cons , car , cdr
11- from cons .core import ConsPair , MaybeCons , ConsNull , rest , ConsError , NonCons
11+ from cons .core import ConsPair , MaybeCons , ConsNull , ConsError , NonCons
1212
1313
1414def assert_all_equal (* tests ):
@@ -54,7 +54,6 @@ def test_cons_type():
5454 assert not isinstance ("hi" , ConsPair )
5555 assert not isinstance (1 , ConsPair )
5656 assert not isinstance (iter ([]), ConsPair )
57- assert not isinstance (rest (iter ([1 ])), ConsPair )
5857 assert not isinstance (OrderedDict ({}), ConsPair )
5958 assert not isinstance ((), ConsPair )
6059 assert not isinstance ([], ConsPair )
@@ -70,7 +69,6 @@ def test_cons_null():
7069 assert isinstance (tuple (), ConsNull )
7170 assert isinstance (OrderedDict (), ConsNull )
7271 assert isinstance (iter ([]), ConsNull )
73- assert isinstance (rest (iter ([1 ])), ConsNull )
7472 assert not isinstance (object , ConsNull )
7573 assert not isinstance ([1 ], ConsNull )
7674 assert not isinstance ((1 ,), ConsNull )
@@ -212,11 +210,14 @@ def test_car_cdr():
212210 # We need to make sure that `__getitem__` is actually used.
213211 from collections import UserList
214212
213+ # Also, make sure `cdr` returns the `__getitem__` result unaltered
214+ clist_res = [5 ]
215+
215216 class CustomList (UserList ):
216217 def __getitem__ (self , * args ):
217- return [ 5 ]
218+ return clist_res
218219
219- assert cdr (CustomList ([1 , 2 , 3 ])) == [ 5 ]
220+ assert cdr (CustomList ([1 , 2 , 3 ])) is clist_res
220221
221222
222223def test_unification ():
0 commit comments