~divmod-dev/divmod.org/myaccount-2503

« back to all changes in this revision

Viewing changes to Axiom/axiom/test/test_item.py

  • Committer: mithrandi
  • Date: 2008-11-04 17:17:19 UTC
  • Revision ID: svn-v4:866e43f7-fbfc-0310-8f2a-ec88d1da2979:trunk:16922
Fix MetaItem.__cmp__

Fixes #2741
Author: mithrandi
Reviewer: exarkun

Different schema versions of the same item type now no longer compare equal,
which fixes some breakage in the upgrade system, among other things.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 
10
10
from axiom import store, item
11
11
from axiom.store import Store
12
 
from axiom.item import Item
 
12
from axiom.item import Item, declareLegacyItem
13
13
from axiom.errors import ChangeRejected
14
14
from axiom.test import itemtest, itemtestmain
15
15
from axiom.attributes import integer, text, inmemory
162
162
        self.failIf(B == A)
163
163
 
164
164
 
 
165
    def test_legacyItemComparison(self):
 
166
        """
 
167
        Legacy items with different versions must not compare equal.
 
168
        """
 
169
        legacy1 = declareLegacyItem('test_type', 1, {})
 
170
        legacy2 = declareLegacyItem('test_type', 2, {})
 
171
        self.assertNotEqual(legacy1, legacy2)
 
172
        self.assertEqual(legacy1, legacy1)
 
173
        self.assertEqual(legacy2, legacy2)
 
174
 
 
175
 
165
176
    def testCreateItem(self):
166
177
        st = store.Store()
167
178
        self.assertRaises(item.CantInstantiateItem, item.Item, store=st)