예제 #1
0
 def test_write_quakeml(self):
     """
     Tests writing a QuakeML document.
     """
     with NamedTemporaryFile() as tf:
         _write_quakeml(self.catalog, tf, validate=IS_RECENT_LXML)
         # Read file again. Avoid the (legit) warning about the already used
         # resource identifiers.
         tf.seek(0)
         with warnings.catch_warnings(record=True):
             warnings.simplefilter("ignore")
             catalog2 = _read_quakeml(tf)
     self.assertTrue(len(catalog2), 1)
예제 #2
0
 def test_write_quakeml(self):
     """
     Tests writing a QuakeML document.
     """
     filename = os.path.join(self.path, 'qml-example-1.2-RC3.xml')
     with NamedTemporaryFile() as tf:
         tmpfile = tf.name
         catalog = _read_quakeml(filename)
         self.assertTrue(len(catalog), 1)
         _write_quakeml(catalog, tmpfile, validate=IS_RECENT_LXML)
         # Read file again. Avoid the (legit) warning about the already used
         # resource identifiers.
         with warnings.catch_warnings(record=True):
             warnings.simplefilter("ignore")
             catalog2 = _read_quakeml(tmpfile)
     self.assertTrue(len(catalog2), 1)