def test_switch_to_object(self): s = W_SetObject(self.space, self.wrapped([1, 2, 3, 4, 5])) s.add(self.space.wrap("six")) assert s.strategy is self.space.fromcache(ObjectSetStrategy) s1 = W_SetObject(self.space, self.wrapped([1, 2, 3, 4, 5])) s2 = W_SetObject(self.space, self.wrapped(["six", "seven"])) s1.update(s2) assert s1.strategy is self.space.fromcache(ObjectSetStrategy)
def test_integer_strategy_with_w_long(self): # tests all calls to is_plain_int1() so far space = self.space w = W_LongObject(rbigint.fromlong(42)) s1 = W_SetObject(space, self.wrapped([])) s1.add(w) assert s1.strategy is space.fromcache(IntegerSetStrategy) # s1 = W_SetObject(space, space.newlist([w])) assert s1.strategy is space.fromcache(IntegerSetStrategy)
def test_switch_to_unicode(self): s = W_SetObject(self.space, self.wrapped([])) s.add(self.space.wrap(u"six")) assert s.strategy is self.space.fromcache(UnicodeSetStrategy)