def test_insert(self): # no change l = W_ListObject(self.space, [self.space.wrap(1),self.space.wrap(2),self.space.wrap(3)]) assert isinstance(l.strategy, IntegerListStrategy) l.insert(3, self.space.wrap(4)) assert isinstance(l.strategy, IntegerListStrategy) # StringStrategy l = W_ListObject(self.space, [self.space.wrap('a'),self.space.wrap('b'),self.space.wrap('c')]) assert isinstance(l.strategy, StringListStrategy) l.insert(3, self.space.wrap(2)) assert isinstance(l.strategy, ObjectListStrategy) # IntegerStrategy l = W_ListObject(self.space, [self.space.wrap(1),self.space.wrap(2),self.space.wrap(3)]) assert isinstance(l.strategy, IntegerListStrategy) l.insert(3, self.space.wrap('d')) assert isinstance(l.strategy, ObjectListStrategy) # EmptyStrategy l = W_ListObject(self.space, []) assert isinstance(l.strategy, EmptyListStrategy) l.insert(0, self.space.wrap('a')) assert isinstance(l.strategy, StringListStrategy) l = W_ListObject(self.space, []) assert isinstance(l.strategy, EmptyListStrategy) l.insert(0, self.space.wrap(2)) assert isinstance(l.strategy, IntegerListStrategy)
def test_insert(self): space = self.space w = space.wrap # no change l = W_ListObject(space, [w(1),w(2),w(3)]) assert isinstance(l.strategy, IntegerListStrategy) l.insert(3, w(4)) assert isinstance(l.strategy, IntegerListStrategy) # BytesStrategy l = W_ListObject(space, [w('a'),w('b'),w('c')]) assert isinstance(l.strategy, BytesListStrategy) l.insert(3, w(2)) assert isinstance(l.strategy, ObjectListStrategy) # UnicodeStrategy l = W_ListObject(space, [w(u'a'),w(u'b'),w(u'c')]) assert isinstance(l.strategy, UnicodeListStrategy) l.insert(3, w(2)) assert isinstance(l.strategy, ObjectListStrategy) # IntegerStrategy l = W_ListObject(space, [w(1),w(2),w(3)]) assert isinstance(l.strategy, IntegerListStrategy) l.insert(3, w('d')) assert isinstance(l.strategy, ObjectListStrategy) # FloatStrategy l = W_ListObject(space, [w(1.1),w(2.2),w(3.3)]) assert isinstance(l.strategy, FloatListStrategy) l.insert(3, w('d')) assert isinstance(l.strategy, ObjectListStrategy) # EmptyStrategy l = W_ListObject(space, []) assert isinstance(l.strategy, EmptyListStrategy) l.insert(0, w('a')) assert isinstance(l.strategy, BytesListStrategy) l = W_ListObject(space, []) assert isinstance(l.strategy, EmptyListStrategy) l.insert(0, w(2)) assert isinstance(l.strategy, IntegerListStrategy)
def test_insert(self): # no change l = W_ListObject( self.space, [self.space.wrap(1), self.space.wrap(2), self.space.wrap(3)]) assert isinstance(l.strategy, IntegerListStrategy) l.insert(3, self.space.wrap(4)) assert isinstance(l.strategy, IntegerListStrategy) # StringStrategy l = W_ListObject( self.space, [self.space.wrap('a'), self.space.wrap('b'), self.space.wrap('c')]) assert isinstance(l.strategy, StringListStrategy) l.insert(3, self.space.wrap(2)) assert isinstance(l.strategy, ObjectListStrategy) # IntegerStrategy l = W_ListObject( self.space, [self.space.wrap(1), self.space.wrap(2), self.space.wrap(3)]) assert isinstance(l.strategy, IntegerListStrategy) l.insert(3, self.space.wrap('d')) assert isinstance(l.strategy, ObjectListStrategy) # FloatStrategy l = W_ListObject( self.space, [self.space.wrap(1.1), self.space.wrap(2.2), self.space.wrap(3.3)]) assert isinstance(l.strategy, FloatListStrategy) l.insert(3, self.space.wrap('d')) assert isinstance(l.strategy, ObjectListStrategy) # EmptyStrategy l = W_ListObject(self.space, []) assert isinstance(l.strategy, EmptyListStrategy) l.insert(0, self.space.wrap('a')) assert isinstance(l.strategy, StringListStrategy) l = W_ListObject(self.space, []) assert isinstance(l.strategy, EmptyListStrategy) l.insert(0, self.space.wrap(2)) assert isinstance(l.strategy, IntegerListStrategy)
def test_insert(self): space = self.space w = space.wrap wb = space.wrapbytes # no change l = W_ListObject(space, [w(1),w(2),w(3)]) assert isinstance(l.strategy, IntegerListStrategy) l.insert(3, w(4)) assert isinstance(l.strategy, IntegerListStrategy) # BytesStrategy l = W_ListObject(space, [wb('a'),wb('b'),wb('c')]) assert isinstance(l.strategy, BytesListStrategy) l.insert(3, w(2)) assert isinstance(l.strategy, ObjectListStrategy) # UnicodeStrategy l = W_ListObject(space, [w(u'a'),w(u'b'),w(u'c')]) assert isinstance(l.strategy, UnicodeListStrategy) l.insert(3, w(2)) assert isinstance(l.strategy, ObjectListStrategy) # IntegerStrategy l = W_ListObject(space, [w(1),w(2),w(3)]) assert isinstance(l.strategy, IntegerListStrategy) l.insert(3, w('d')) assert isinstance(l.strategy, ObjectListStrategy) # FloatStrategy l = W_ListObject(space, [w(1.1),w(2.2),w(3.3)]) assert isinstance(l.strategy, FloatListStrategy) l.insert(3, w('d')) assert isinstance(l.strategy, ObjectListStrategy) # EmptyStrategy l = W_ListObject(space, []) assert isinstance(l.strategy, EmptyListStrategy) l.insert(0, wb('a')) assert isinstance(l.strategy, BytesListStrategy) l = W_ListObject(space, []) assert isinstance(l.strategy, EmptyListStrategy) l.insert(0, w(2)) assert isinstance(l.strategy, IntegerListStrategy)