Changeset 391 for python/trunk/Lib/test/test_contains.py
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Lib/test/test_contains.py
r2 r391 21 21 b = set(1) 22 22 c = seq(1) 23 self.assert _(1 inb)24 self.assert _(0 not inb)25 self.assert _(1 inc)26 self.assert _(0 not inc)23 self.assertIn(1, b) 24 self.assertNotIn(0, b) 25 self.assertIn(1, c) 26 self.assertNotIn(0, c) 27 27 self.assertRaises(TypeError, lambda: 1 in a) 28 28 self.assertRaises(TypeError, lambda: 1 not in a) 29 29 30 30 # test char in string 31 self.assert _('c' in'abc')32 self.assert _('d' not in'abc')31 self.assertIn('c', 'abc') 32 self.assertNotIn('d', 'abc') 33 33 34 self.assert _('' in'')35 self.assert _('' in'abc')34 self.assertIn('', '') 35 self.assertIn('', 'abc') 36 36 37 37 self.assertRaises(TypeError, lambda: None in 'abc') … … 39 39 if have_unicode: 40 40 def test_char_in_unicode(self): 41 self.assert _('c' inunicode('abc'))42 self.assert _('d' not inunicode('abc'))41 self.assertIn('c', unicode('abc')) 42 self.assertNotIn('d', unicode('abc')) 43 43 44 self.assert _('' inunicode(''))45 self.assert _(unicode('') in'')46 self.assert _(unicode('') inunicode(''))47 self.assert _('' inunicode('abc'))48 self.assert _(unicode('') in'abc')49 self.assert _(unicode('') inunicode('abc'))44 self.assertIn('', unicode('')) 45 self.assertIn(unicode(''), '') 46 self.assertIn(unicode(''), unicode('')) 47 self.assertIn('', unicode('abc')) 48 self.assertIn(unicode(''), 'abc') 49 self.assertIn(unicode(''), unicode('abc')) 50 50 51 51 self.assertRaises(TypeError, lambda: None in unicode('abc')) 52 52 53 53 # test Unicode char in Unicode 54 self.assert _(unicode('c') inunicode('abc'))55 self.assert _(unicode('d') not inunicode('abc'))54 self.assertIn(unicode('c'), unicode('abc')) 55 self.assertNotIn(unicode('d'), unicode('abc')) 56 56 57 57 # test Unicode char in string 58 self.assert _(unicode('c') in'abc')59 self.assert _(unicode('d') not in'abc')58 self.assertIn(unicode('c'), 'abc') 59 self.assertNotIn(unicode('d'), 'abc') 60 60 61 61 def test_builtin_sequence_types(self): … … 63 63 a = range(10) 64 64 for i in a: 65 self.assert _(i ina)66 self.assert _(16 not ina)67 self.assert _(a not ina)65 self.assertIn(i, a) 66 self.assertNotIn(16, a) 67 self.assertNotIn(a, a) 68 68 69 69 a = tuple(a) 70 70 for i in a: 71 self.assert _(i ina)72 self.assert _(16 not ina)73 self.assert _(a not ina)71 self.assertIn(i, a) 72 self.assertNotIn(16, a) 73 self.assertNotIn(a, a) 74 74 75 75 class Deviant1: … … 87 87 return 1 88 88 89 self.assert _(Deviant1() not inDeviant1.aList)89 self.assertNotIn(Deviant1(), Deviant1.aList) 90 90 91 91 class Deviant2: … … 100 100 101 101 try: 102 self.assert _(Deviant2() not ina)102 self.assertNotIn(Deviant2(), a) 103 103 except TypeError: 104 104 pass
Note:
See TracChangeset
for help on using the changeset viewer.