135
135
def test_concat_with_bad_tuple(self):
136
136
st1 = self.module.StaticTuple('foo')
143
self.fail('TypeError not raised')
138
# Using st1.__add__ doesn't give the same results as doing the '+' form
139
self.assertRaises(TypeError, lambda: st1 + t2)
145
141
def test_concat_with_non_tuple(self):
146
142
st1 = self.module.StaticTuple('foo')
152
self.fail('TypeError not raised for addition w/ an int')
143
self.assertRaises(TypeError, lambda: st1 + 10)
154
145
def test_as_tuple(self):
155
146
k = self.module.StaticTuple('foo')
225
216
def test_holds_None(self):
226
217
k1 = self.module.StaticTuple(None)
218
# You cannot subclass None anyway
228
220
def test_holds_int(self):
229
221
k1 = self.module.StaticTuple(1)
224
# But not a subclass, because subint could introduce refcycles
225
self.assertRaises(TypeError, self.module.StaticTuple, subint(2))
231
227
def test_holds_long(self):
232
228
k1 = self.module.StaticTuple(2L**65)
232
self.assertRaises(TypeError, self.module.StaticTuple, sublong(1))
234
234
def test_holds_float(self):
235
235
k1 = self.module.StaticTuple(1.2)
236
class subfloat(float):
238
self.assertRaises(TypeError, self.module.StaticTuple, subfloat(1.5))
240
def test_holds_str(self):
241
k1 = self.module.StaticTuple('astring')
244
self.assertRaises(TypeError, self.module.StaticTuple, substr('a'))
237
246
def test_holds_unicode(self):
238
247
k1 = self.module.StaticTuple(u'\xb5')
248
class subunicode(unicode):
250
self.assertRaises(TypeError, self.module.StaticTuple,
240
253
def test_hold_bool(self):
241
254
k1 = self.module.StaticTuple(True)
242
255
k2 = self.module.StaticTuple(False)
256
# Cannot subclass bool
244
258
def test_compare_same_obj(self):
245
259
k1 = self.module.StaticTuple('foo', 'bar')