예제 #1
0
파일: test_parser.py 프로젝트: znamy/obspy
 def test_issue_157(self):
     """
     Test case for issue #157: re-using parser object.
     """
     expected = {
         'latitude': 48.162899,
         'elevation': 565.0,
         'longitude': 11.2752,
         'local_depth': 0.0,
         'azimuth': 0.0,
         'dip': -90.0
     }
     filename1 = os.path.join(self.path, 'dataless.seed.BW_FURT')
     filename2 = os.path.join(self.path, 'dataless.seed.BW_MANZ')
     t = UTCDateTime("2010-07-01")
     parser = Parser()
     parser.read(filename2)
     # parsing a second time will raise a UserWarning: Clearing parser
     # before every subsequent read()
     with warnings.catch_warnings(record=True):
         warnings.simplefilter("error", UserWarning)
         self.assertRaises(UserWarning, parser.read, filename1)
         warnings.simplefilter("ignore", UserWarning)
         parser.read(filename1)
         result = parser.get_coordinates("BW.FURT..EHZ", t)
         self.assertEqual(expected, result)
예제 #2
0
 def test_issue_157(self):
     """
     Test case for issue #157: re-using parser object.
     """
     expected = {'latitude': 48.162899, 'elevation': 565.0,
                 'longitude': 11.2752, 'local_depth': 0.0,
                 'azimuth': 0.0, 'dip': -90.0}
     filename1 = os.path.join(self.path, 'dataless.seed.BW_FURT')
     filename2 = os.path.join(self.path, 'dataless.seed.BW_MANZ')
     t = UTCDateTime("2010-07-01")
     parser = Parser()
     parser.read(filename2)
     # parsing a second time will raise a UserWarning: Clearing parser
     # before every subsequent read()
     with warnings.catch_warnings(record=True):
         warnings.simplefilter("error", UserWarning)
         self.assertRaises(UserWarning, parser.read, filename1)
         warnings.simplefilter("ignore", UserWarning)
         parser.read(filename1)
         result = parser.get_coordinates("BW.FURT..EHZ", t)
         self.assertEqual(expected, result)