コード例 #1
0
    def notest_list_empty_after_delete(self):
        l = W_ListObject(self.space, [self.space.wrap(3)])
        assert isinstance(l.strategy, IntegerListStrategy)
        l.deleteitem(0)
        assert isinstance(l.strategy, EmptyListStrategy)

        l = W_ListObject(self.space, [self.space.wrap(1), self.space.wrap(2)])
        assert isinstance(l.strategy, IntegerListStrategy)
        l.deleteslice(0, 1, 2)
        assert isinstance(l.strategy, EmptyListStrategy)

        l = W_ListObject(self.space, [self.space.wrap(1)])
        assert isinstance(l.strategy, IntegerListStrategy)
        l.pop(-1)
        assert isinstance(l.strategy, EmptyListStrategy)
コード例 #2
0
    def test_list_empty_after_delete(self):
        py.test.skip("return to emptyliststrategy is not supported anymore")
        l = W_ListObject(self.space, [self.space.wrap(3)])
        assert isinstance(l.strategy, IntegerListStrategy)
        l.deleteitem(0)
        assert isinstance(l.strategy, EmptyListStrategy)

        l = W_ListObject(self.space, [self.space.wrap(1), self.space.wrap(2)])
        assert isinstance(l.strategy, IntegerListStrategy)
        l.deleteslice(0, 1, 2)
        assert isinstance(l.strategy, EmptyListStrategy)

        l = W_ListObject(self.space, [self.space.wrap(1)])
        assert isinstance(l.strategy, IntegerListStrategy)
        l.pop(-1)
        assert isinstance(l.strategy, EmptyListStrategy)
コード例 #3
0
 def test_pop_without_argument_is_fast(self):
     space = self.space
     w_l = W_ListObject(
         space, [space.wrap(1), space.wrap(2),
                 space.wrap(3)])
     w_l.pop = None
     w_res = w_l.descr_pop(space)
     assert space.unwrap(w_res) == 3
コード例 #4
0
 def test_pop_without_argument_is_fast(self):
     space = self.space
     w_l = W_ListObject(
         space, [space.wrap(1), space.wrap(2),
                 space.wrap(3)])
     w_l.pop = None
     w_res = listobject.list_pop__List_ANY(space, w_l,
                                           space.w_None)  # does not crash
     assert space.unwrap(w_res) == 3
コード例 #5
0
 def test_pop_without_argument_is_fast(self):
     space = self.space
     w_l = W_ListObject(space, [space.wrap(1), space.wrap(2), space.wrap(3)])
     w_l.pop = None
     w_res = listobject.list_pop__List_ANY(space, w_l, space.w_None) # does not crash
     assert space.unwrap(w_res) == 3
コード例 #6
0
ファイル: test_liststrategies.py プロジェクト: Darriall/pypy
 def test_pop_without_argument_is_fast(self):
     space = self.space
     w_l = W_ListObject(space, [space.wrap(1), space.wrap(2), space.wrap(3)])
     w_l.pop = None
     w_res = w_l.descr_pop(space)
     assert space.unwrap(w_res) == 3