Пример #1
0
 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)
Пример #2
0
    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)
Пример #3
0
 def testCmp(self):
     a = Profile()
     b = Profile()
     self.assertEquals(a, b)