Пример #1
0
    def test_basic(self):
        field = Field(var='test')
        self.assertEqual('text-single', field.fieldType)
        self.assertEqual('test', field.var)

        element = field.toElement()

        self.assertTrue(domish.IElement.providedBy(element))
        self.assertEquals('field', element.name)
        self.assertEquals(NS_X_DATA, element.uri)
        self.assertEquals('text-single', element['type'])
        self.assertEquals('test', element['var'])
        self.assertEquals([], element.children)
Пример #2
0
    def test_basic(self):
        field = Field(var='test')
        self.assertEqual('text-single', field.fieldType)
        self.assertEqual('test', field.var)

        element = field.toElement()

        self.assertTrue(domish.IElement.providedBy(element))
        self.assertEquals('field', element.name)
        self.assertEquals(NS_X_DATA, element.uri)
        self.assertEquals('text-single', element['type'])
        self.assertEquals('test', element['var'])
        self.assertEquals([], element.children)
Пример #3
0
 def test_fromElementValue(self):
     element = domish.Element((NS_X_DATA, 'field'))
     element.addElement("value", content="text")
     field = Field.fromElement(element)
     self.assertEquals('text', field.value)
Пример #4
0
 def test_fromElementNoType(self):
     element = domish.Element((NS_X_DATA, 'field'))
     field = Field.fromElement(element)
     self.assertEquals(None, field.fieldType)
Пример #5
0
 def test_fromElementType(self):
     element = domish.Element((NS_X_DATA, 'field'))
     element['type'] = 'fixed'
     field = Field.fromElement(element)
     self.assertEquals('fixed', field.fieldType)
Пример #6
0
 def test_noFieldName(self):
     field = Field()
     self.assertRaises(FieldNameRequiredError, field.toElement)
Пример #7
0
 def test_fromElementValue(self):
     element = domish.Element((NS_X_DATA, 'field'))
     element.addElement("value", content="text")
     field = Field.fromElement(element)
     self.assertEquals('text', field.value)
Пример #8
0
 def test_fromElementNoType(self):
     element = domish.Element((NS_X_DATA, 'field'))
     field = Field.fromElement(element)
     self.assertEquals(None, field.fieldType)
Пример #9
0
 def test_fromElementType(self):
     element = domish.Element((NS_X_DATA, 'field'))
     element['type'] = 'fixed'
     field = Field.fromElement(element)
     self.assertEquals('fixed', field.fieldType)