~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Lib/test/test_descr.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-03-11 13:30:19 UTC
  • mto: (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: james.westby@ubuntu.com-20100311133019-sblbooa3uqrkoe70
Tags: upstream-2.6.5~rc2
ImportĀ upstreamĀ versionĀ 2.6.5~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1142
1142
            del h
1143
1143
        self.assertEqual(s.getvalue(), '')
1144
1144
 
 
1145
        class X(object):
 
1146
            __slots__ = "a"
 
1147
        try:
 
1148
            del X().a
 
1149
        except AttributeError:
 
1150
            pass
 
1151
        else:
 
1152
            self.fail("didn't raise AttributeError")
 
1153
 
1145
1154
    def test_slots_special(self):
1146
1155
        # Testing __dict__ and __weakref__ in __slots__...
1147
1156
        class D(object):
1198
1207
        # This used to crash
1199
1208
        self.assertRaises(TypeError, MyABC.a.__set__, u, 3)
1200
1209
 
 
1210
    def test_metaclass_cmp(self):
 
1211
        # See bug 7491.
 
1212
        class M(type):
 
1213
            def __cmp__(self, other):
 
1214
                return -1
 
1215
        class X(object):
 
1216
            __metaclass__ = M
 
1217
        self.assertTrue(X < M)
 
1218
 
1201
1219
    def test_dynamics(self):
1202
1220
        # Testing class attribute propagation...
1203
1221
        class D(object):
1767
1785
 
1768
1786
        # Safety test for __cmp__
1769
1787
        def unsafecmp(a, b):
 
1788
            if not hasattr(a.__class__, "__cmp__"):
 
1789
                return
1770
1790
            try:
1771
1791
                a.__class__.__cmp__(a, b)
1772
1792
            except TypeError: