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

        node = self._get_node('<node a=""/>')
        self.assertIsNone(manifest_xml.XmlInt(node, 'a'))
Example #2
0
 def test_int_invalid(self):
     """Check XmlInt invalid handling."""
     with self.assertRaises(error.ManifestParseError):
         node = self._get_node('<node a="xx"/>')
         manifest_xml.XmlInt(node, 'a')
Example #3
0
 def test_int_good(self):
     """Check XmlInt numeric handling."""
     for value in (-1, 0, 1, 50000):
         node = self._get_node('<node a="%s"/>' % (value, ))
         self.assertEqual(value, manifest_xml.XmlInt(node, 'a'))