Beispiel #1
0
    def test_bool_default(self):
        """Check XmlBool default handling."""
        node = self._get_node('<node/>')
        self.assertIsNone(manifest_xml.XmlBool(node, 'a'))
        self.assertIsNone(manifest_xml.XmlBool(node, 'a', None))
        self.assertEqual(123, manifest_xml.XmlBool(node, 'a', 123))

        node = self._get_node('<node a=""/>')
        self.assertIsNone(manifest_xml.XmlBool(node, 'a'))
Beispiel #2
0
 def test_bool_true(self):
     """Check XmlBool true values."""
     for value in ('yes', 'true', '1'):
         node = self._get_node('<node a="%s"/>' % (value, ))
         self.assertTrue(manifest_xml.XmlBool(node, 'a'))
Beispiel #3
0
 def test_bool_false(self):
     """Check XmlBool false values."""
     for value in ('no', 'false', '0'):
         node = self._get_node('<node a="%s"/>' % (value, ))
         self.assertFalse(manifest_xml.XmlBool(node, 'a'))
Beispiel #4
0
 def test_bool_invalid(self):
     """Check XmlBool invalid handling."""
     node = self._get_node('<node a="moo"/>')
     self.assertEqual(123, manifest_xml.XmlBool(node, 'a', 123))