def test_format_class(self): """Test pywps.formats.Format class """ frmt = Format('mimetype', schema='halloworld', encoding='asdf', validate=self.validate) self.assertEqual(frmt.mime_type, 'mimetype') self.assertEqual(frmt.schema, 'halloworld') self.assertEqual(frmt.encoding, 'asdf') self.assertTrue(frmt.validate('the input', 1)) describeel = frmt.describe_xml() self.assertEqual('Format', describeel.tag) mimetype = xpath_ns(describeel, '/Format/MimeType') encoding = xpath_ns(describeel, '/Format/Encoding') schema = xpath_ns(describeel, '/Format/Schema') self.assertTrue(mimetype) self.assertTrue(encoding) self.assertTrue(schema) self.assertEqual(mimetype[0].text, 'mimetype') self.assertEqual(encoding[0].text, 'asdf') self.assertEqual(schema[0].text, 'halloworld') frmt2 = get_format('GML') self.assertFalse(frmt.same_as(frmt2))
def test_format_class(self): """Test pywps.formats.Format class """ frmt = Format('mimetype', schema='halloworld', encoding='asdf', validate=self.validate) self.assertEqual(frmt.mime_type, 'mimetype') self.assertEqual(frmt.schema, 'halloworld') self.assertEqual(frmt.encoding, 'asdf') self.assertTrue(frmt.validate('the input', 1)) describeel = frmt.json self.assertEqual(describeel["mime_type"], 'mimetype') self.assertEqual(describeel["encoding"], 'asdf') self.assertEqual(describeel["schema"], 'halloworld') frmt2 = get_format('GML') self.assertFalse(frmt.same_as(frmt2))