def setUp(self, super_mock): self.file_mock = MagicMock() super_mock.return_value = self.file_mock self.dbh = rfh5.DBHandler('a', 'r', 'gzip9') tr = read()[0] tr.data = np.ones_like(tr.data, dtype=int) tr.stats['phase'] = 'P' tr.stats['pol'] = 'v' tr.stats.station_latitude = 15 tr.stats.station_longitude = -55 tr.stats.station_elevation = 355 tr.stats.event_time = tr.stats.starttime self.rftr = RFTrace(tr.data, header=tr.stats)
def test_add_different_object(self, super_mock): super_mock.return_value = None dbh = rfh5.DBHandler('a', 'r', 'gzip9') with self.assertRaises(TypeError): dbh.add_rf(read())
def test_no_compression_name(self, super_mock): super_mock.return_value = None with self.assertRaises(IndexError): _ = rfh5.DBHandler('a', 'a', '9')
def test_forbidden_compression_level(self, super_mock): super_mock.return_value = None with warnings.catch_warnings(record=True) as w: dbh = rfh5.DBHandler('a', 'a', 'gzip10') self.assertEqual(dbh.compression_opts, 9) self.assertEqual(len(w), 1)
def test_forbidden_compression(self, super_mock): super_mock.return_value = None with self.assertRaises(ValueError): _ = rfh5.DBHandler('a', 'a', 'notexisting5')