Example #1
0
 def testSchemaSupport (self):
     instance = trac26.eTranslateCard(trac26.eConcCardCymru('un'),
                                      trac26.eConcCardEnglish('one'),
                                      xs.int(1))
     self.assertTrue(instance.validateBinding())
     instance = trac26.CreateFromDocument(self.Good_xmlt)
     self.assertEqual(self.Good_xmld, instance.toxml('utf-8', root_only=True))
     instance = trac26.eTranslateCard(trac26.eConcCardCymru('un'))
     instance.cardinal = 1
     instance.eConcCardEnglish = 'one'
     self.assertTrue(instance.validateBinding())
Example #2
0
 def testSchemaSupport(self):
     instance = trac26.eTranslateCard(trac26.eConcCardCymru('un'),
                                      trac26.eConcCardEnglish('one'),
                                      xs.int(1))
     self.assertTrue(instance.validateBinding())
     instance = trac26.CreateFromDocument(self.Good_xmlt)
     self.assertEqual(self.Good_xmld, instance.toxml('utf-8',
                                                     root_only=True))
     instance = trac26.eTranslateCard(trac26.eConcCardCymru('un'))
     instance.cardinal = 1
     instance.eConcCardEnglish = 'one'
     self.assertTrue(instance.validateBinding())
Example #3
0
    def testSchemaSupport (self):
        cym1 = trac26.eConcCardCymru('un')
        eng3 = trac26.eConcCardEnglish('three')

        # Incremental through owning element
        instance = trac26.eCardinals()
        self.assertEqual(0, len(instance.eAbstractCard))
        instance.append(cym1)
        self.assertEqual(1, len(instance.eAbstractCard))
        self.assertTrue(isinstance(instance.eAbstractCard[0], trac26.tCardCymru))
        instance.append(eng3)
        self.assertEqual(2, len(instance.eAbstractCard))
        self.assertTrue(isinstance(instance.eAbstractCard[1], trac26.tCardEnglish))
        self.assertTrue(instance.validateBinding())
        xmld = instance.toxml('utf-8', root_only=True)
        self.assertEqual(xmld, self.Good_xmld)

        # Incremental through construtor element
        instance = trac26.eCardinals(cym1, eng3)
        self.assertEqual(2, len(instance.eAbstractCard))
        self.assertTrue(isinstance(instance.eAbstractCard[0], trac26.tCardCymru))
        self.assertTrue(isinstance(instance.eAbstractCard[1], trac26.tCardEnglish))
        self.assertTrue(instance.validateBinding())
        xmld = instance.toxml('utf-8', root_only=True)
        self.assertEqual(xmld, self.Good_xmld)

        # Through parsing
        instance = trac26.CreateFromDocument(self.Good_xmlt)
        self.assertEqual(2, len(instance.eAbstractCard))
        self.assertTrue(isinstance(instance.eAbstractCard[0], trac26.tCardCymru))
        self.assertTrue(isinstance(instance.eAbstractCard[1], trac26.tCardEnglish))
        self.assertTrue(instance.validateBinding())
Example #4
0
 def testSchemaSupport(self):
     instance = trac26.eTranslateCardMulti(trac26.eConcCardCymru('un'),
                                           trac26.eConcCardEnglish('one'),
                                           xs.int(1))
     self.assertTrue(instance.validateBinding())
     instance.eConcCardCymru.append('dau')
     instance.eConcCardEnglish.append('two')
     instance.cardinal.append(2)
     self.assertTrue(instance.validateBinding())
Example #5
0
 def testSchemaSupport (self):
     instance = trac26.eTranslateCardMulti(trac26.eConcCardCymru('un'),
                                           trac26.eConcCardEnglish('one'),
                                           xs.int(1))
     self.assertTrue(instance.validateBinding())
     instance.eConcCardCymru.append('dau')
     instance.eConcCardEnglish.append('two')
     instance.cardinal.append(2)
     self.assertTrue(instance.validateBinding())
Example #6
0
 def testException(self):
     instance = trac26.eTranslateCard(trac26.eConcCardCymru('un'))
     instance.cardinal = 1
     with self.assertRaises(pyxb.IncompleteElementContentError) as cm:
         instance.validateBinding()
     e = cm.exception
     self.assertFalse(e.fac_configuration.isAccepting())
     self.assertEqual(1, len(e.symbols))
     self.assertEqual(1, len(e.symbol_set))
     (ed, syms) = e.symbol_set.iteritems().next()
     self.assertEqual(1, len(syms))
     self.assertEqual(instance.cardinal, syms[0])
     self.assertEqual(e.details(), self.Bad_details)
Example #7
0
 def testException (self):
     instance = trac26.eTranslateCard(trac26.eConcCardCymru('un'))
     instance.cardinal = 1
     with self.assertRaises(pyxb.IncompleteElementContentError) as cm:
         instance.validateBinding()
     e = cm.exception
     self.assertFalse(e.fac_configuration.isAccepting())
     self.assertEqual(1, len(e.symbols))
     self.assertEqual(1, len(e.symbol_set))
     (ed, syms) = e.symbol_set.iteritems().next()
     self.assertEqual(1, len(syms))
     self.assertEqual(instance.cardinal, syms[0])
     self.assertEqual(e.details(), self.Bad_details)
Example #8
0
 def testException(self):
     instance = trac26.eTranslateCardMulti(trac26.eConcCardCymru('un'),
                                           trac26.eConcCardEnglish('one'),
                                           xs.int(1))
     self.assertTrue(instance.validateBinding())
     instance.cardinal.append(2)
     with self.assertRaises(pyxb.UnprocessedElementContentError) as cm:
         instance.validateBinding()
     e = cm.exception
     self.assertTrue(e.fac_configuration.isAccepting())
     self.assertEqual(3, len(e.symbols))
     self.assertEqual(1, len(e.symbol_set))
     (ed, syms) = e.symbol_set.iteritems().next()
     self.assertEqual(1, len(syms))
     self.assertEqual(instance.cardinal[1], syms[0])
     self.assertEqual(e.details(), self.Bad_details)
Example #9
0
 def testException(self):
     instance = trac26.eTranslateCard(trac26.eConcCardCymru('un'))
     instance.cardinal = 1
     with self.assertRaises(pyxb.IncompleteElementContentError) as cm:
         instance.validateBinding()
     e = cm.exception
     self.assertFalse(e.fac_configuration.isAccepting())
     self.assertEqual(1, len(e.symbols))
     self.assertEqual(1, len(e.symbol_set))
     (ed, syms) = next(six.iteritems(e.symbol_set))
     self.assertEqual(1, len(syms))
     self.assertEqual(instance.cardinal, syms[0])
     expect = self.Bad_details
     if pyxb.XMLStyle_minidom == pyxb._XMLStyle:
         expect = self.Bad_details_noloc
     self.assertEqual(e.details(), expect)
Example #10
0
 def testException (self):
     instance = trac26.eTranslateCard(trac26.eConcCardCymru('un'))
     instance.cardinal = 1
     with self.assertRaises(pyxb.IncompleteElementContentError) as cm:
         instance.validateBinding()
     e = cm.exception
     self.assertFalse(e.fac_configuration.isAccepting())
     self.assertEqual(1, len(e.symbols))
     self.assertEqual(1, len(e.symbol_set))
     (ed, syms) = next(six.iteritems(e.symbol_set))
     self.assertEqual(1, len(syms))
     self.assertEqual(instance.cardinal, syms[0])
     expect = self.Bad_details
     if pyxb.XMLStyle_minidom == pyxb._XMLStyle:
         expect = self.Bad_details_noloc
     self.assertEqual(e.details(), expect)
Example #11
0
 def testException (self):
     instance = trac26.eTranslateCardMulti(trac26.eConcCardCymru('un'),
                                           trac26.eConcCardEnglish('one'),
                                           xs.int(1))
     self.assertTrue(instance.validateBinding())
     instance.cardinal.append(2)
     with self.assertRaises(pyxb.UnprocessedElementContentError) as cm:
         instance.validateBinding()
     e = cm.exception
     self.assertTrue(e.fac_configuration.isAccepting())
     self.assertEqual(3, len(e.symbols))
     self.assertEqual(1, len(e.symbol_set))
     (ed, syms) = e.symbol_set.iteritems().next()
     self.assertEqual(1, len(syms))
     self.assertEqual(instance.cardinal[1], syms[0])
     self.assertEqual(e.details(), self.Bad_details)
Example #12
0
    def testSchemaSupport(self):
        cym1 = trac26.eConcCardCymru('un')
        eng3 = trac26.eConcCardEnglish('three')

        # Incremental through owning element
        instance = trac26.eCardinals()
        self.assertEqual(0, len(instance.eAbstractCard))
        instance.append(cym1)
        self.assertEqual(1, len(instance.eAbstractCard))
        self.assertTrue(
            isinstance(instance.eAbstractCard[0], trac26.tCardCymru))
        instance.append(eng3)
        self.assertEqual(2, len(instance.eAbstractCard))
        self.assertTrue(
            isinstance(instance.eAbstractCard[1], trac26.tCardEnglish))
        self.assertTrue(instance.validateBinding())
        xmld = instance.toxml('utf-8', root_only=True)
        self.assertEqual(xmld, self.Good_xmld)

        # Incremental through construtor element
        instance = trac26.eCardinals(cym1, eng3)
        self.assertEqual(2, len(instance.eAbstractCard))
        self.assertTrue(
            isinstance(instance.eAbstractCard[0], trac26.tCardCymru))
        self.assertTrue(
            isinstance(instance.eAbstractCard[1], trac26.tCardEnglish))
        self.assertTrue(instance.validateBinding())
        xmld = instance.toxml('utf-8', root_only=True)
        self.assertEqual(xmld, self.Good_xmld)

        # Through parsing
        instance = trac26.CreateFromDocument(self.Good_xmlt)
        self.assertEqual(2, len(instance.eAbstractCard))
        self.assertTrue(
            isinstance(instance.eAbstractCard[0], trac26.tCardCymru))
        self.assertTrue(
            isinstance(instance.eAbstractCard[1], trac26.tCardEnglish))
        self.assertTrue(instance.validateBinding())