Пример #1
0
 def test_plot_wrong_label_type(self):
     cr = CrossCorrelation(self.lc1, self.lc2)
     with pytest.raises(TypeError):
         with warnings.catch_warnings(record=True) as w:
             cr.plot(labels=123)
             assert np.any([
                 "must be either a list or tuple" in str(wi.message)
                 for wi in w
             ])
Пример #2
0
 def test_plot_custom_filename(self):
     cr = CrossCorrelation(self.lc1, self.lc2)
     cr.plot(save=True, filename='cr.png')
     assert os.path.isfile('cr.png')
     os.unlink('cr.png')
Пример #3
0
 def test_plot_default_filename(self):
     cr = CrossCorrelation(self.lc1, self.lc2)
     cr.plot(save=True, title="Correlation")
     assert os.path.isfile('corr.pdf')
     os.unlink('corr.pdf')
Пример #4
0
 def test_plot_title(self):
     cr = CrossCorrelation(self.lc1, self.lc2)
     cr.plot(title="Test for Cross Correlation")
     assert plt.fignum_exists(1)
Пример #5
0
 def test_plot_axis(self):
     cr = CrossCorrelation(self.lc1, self.lc2)
     cr.plot(axis=[0, 1, 0, 100])
     assert plt.fignum_exists(1)
Пример #6
0
 def test_plot_labels_index_error(self):
     cr = CrossCorrelation(self.lc1, self.lc2)
     with warnings.catch_warnings(record=True) as w:
         cr.plot(labels='x')
         assert np.any(
             ["must have two labels" in str(wi.message) for wi in w])
Пример #7
0
 def test_simple_plot(self):
     cr = CrossCorrelation(self.lc1, self.lc2)
     cr.plot()
     assert plt.fignum_exists(1)
 def test_plot_custom_filename(self):
     cr = CrossCorrelation(self.lc1, self.lc2)
     cr.plot(save=True, filename='cr.png')
     assert os.path.isfile('cr.png')
     os.unlink('cr.png')
Пример #9
0
 def test_plot_matplotlib_not_installed(self):
     cr = CrossCorrelation(self.lc1, self.lc2)
     with pytest.raises(ImportError) as excinfo:
         cr.plot()
     message = str(excinfo.value)
     assert "Matplotlib required for plot()" in message
 def test_plot_title(self):
     cr = CrossCorrelation(self.lc1, self.lc2)
     cr.plot(title="Test for Cross Correlation")
     assert plt.fignum_exists(1)
 def test_plot_default_filename(self):
     cr = CrossCorrelation(self.lc1, self.lc2)
     cr.plot(save=True)
     assert os.path.isfile('corr.png')
     os.unlink('corr.png')
 def test_plot_axis(self):
     cr = CrossCorrelation(self.lc1, self.lc2)
     cr.plot(axis=[0, 1, 0, 100])
     assert plt.fignum_exists(1)
 def test_plot_labels_index_error(self):
     cr = CrossCorrelation(self.lc1, self.lc2)
     with warnings.catch_warnings(record=True) as w:
         cr.plot(labels='x')
         assert "must have two labels" in str(w[0].message)
 def test_plot_wrong_label_type(self):
     cr = CrossCorrelation(self.lc1, self.lc2)
     with pytest.raises(TypeError):
         with warnings.catch_warnings(record=True) as w:
             cr.plot(labels=123)
             assert "must be either a list or tuple" in str(w[0].message)
 def test_simple_plot(self):
     cr = CrossCorrelation(self.lc1, self.lc2)
     cr.plot()
     assert plt.fignum_exists(1)
 def test_plot_matplotlib_not_installed(self):
     cr = CrossCorrelation(self.lc1, self.lc2)
     with pytest.raises(ImportError) as excinfo:
         cr.plot()
     message = str(excinfo.value)
     assert "Matplotlib required for plot()" in message