def test_compare(self): s = W_SetObject(self.space, newset(self.space)) _initialize_set(self.space, s, self.word) t = W_SetObject(self.space, newset(self.space)) _initialize_set(self.space, t, self.word) assert self.space.eq_w(s,t) u = self.space.wrap(set('simsalabim')) assert self.space.eq_w(s,u)
def test_compare(self): s = W_SetObject(self.space, newset(self.space)) _initialize_set(self.space, s, self.word) t = W_SetObject(self.space, newset(self.space)) _initialize_set(self.space, t, self.word) assert self.space.eq_w(s, t) u = self.space.wrap(set('simsalabim')) assert self.space.eq_w(s, u)
def test_and(self): s = W_SetObject(self.space, newset(self.space)) _initialize_set(self.space, s, self.word) t0 = W_SetObject(self.space, newset(self.space)) _initialize_set(self.space, t0, self.otherword) t1 = W_FrozensetObject(self.space, make_setdata_from_w_iterable(self.space, self.otherword)) r0 = and__Set_Set(self.space, s, t0) r1 = and__Set_Set(self.space, s, t1) assert eq__Set_Set(self.space, r0, r1) == self.true sr = set_intersection__Set(self.space, s, [self.otherword]) assert eq__Set_Set(self.space, r0, sr) == self.true
def test_and(self): s = W_SetObject(self.space, newset(self.space)) _initialize_set(self.space, s, self.word) t0 = W_SetObject(self.space, newset(self.space)) _initialize_set(self.space, t0, self.otherword) t1 = W_FrozensetObject( self.space, make_setdata_from_w_iterable(self.space, self.otherword)) r0 = and__Set_Set(self.space, s, t0) r1 = and__Set_Set(self.space, s, t1) assert eq__Set_Set(self.space, r0, r1) == self.true sr = set_intersection__Set(self.space, s, [self.otherword]) assert eq__Set_Set(self.space, r0, sr) == self.true
def newset(self): from pypy.objspace.std.setobject import newset return W_SetObject(self, newset(self))
def descr__new__(space, w_settype, __args__): from pypy.objspace.std.setobject import W_SetObject, newset w_obj = space.allocate_instance(W_SetObject, w_settype) W_SetObject.__init__(w_obj, space, newset(space)) return w_obj