def testInstances(self): '''Test to ensure isntances don't share isntance data. ''' a = Profile() b = Profile() self.assertEquals(a, b) a.profElements['a'] = 'b' self.assertNotEquals(a, b)
def testXML(self): '''Test XML serialization and recomposition from XML. ''' a = Profile() doc = xml.dom.minidom.getDOMImplementation().createDocument(None, None, None) node = a.toXML(doc) b = Profile(node=node) self.assertEquals(a, b) x = UnspecifiedProfileElement('tastiness', 'How tasty it was', 'char', 'subjective', ['yumminess'], 'This is highly subjective.') y = EnumeratedProfileElement('meal', 'What meal was eaten', 'char', 'meal', ['serving'], 'Typical values', ['Breakfast', 'Brunch', 'Lunch', 'Dinner']) z = RangedProfileElement('spicyness', 'How spicy it was', 'float', 'scovilles', ['piquancy'], 'Hotter the better, I say', 0.0, 1000000.0) a.profElements['tastiness'], a.profElements['meal'], a.profElements['spicyness'] = x, y, z node = a.toXML(doc) b = Profile(node=node) self.assertEquals(a, b)
def testCmp(self): a = Profile() b = Profile() self.assertEquals(a, b)