def test_read_early_eof_with_data(): for mmap in [False, True]: with open(datafile('test-44100Hz-le-1ch-4bytes-early-eof.wav'), 'rb') as fp: with assert_warns(wavfile.WavFileWarning, match='Reached EOF'): rate, data = wavfile.read(fp, mmap=mmap) assert_(data.size > 0) assert_equal(rate, 44100) del data
def test_fallback_to_asym_method(self): match_text = "The asymptotic approximation will be used" with assert_warns(UserWarning, match=match_text): statistic, pval, _ = ddm.distance_covariance_test(self.x, self.y, method="emp", B=200) assert_almost_equal(statistic, self.test_stat_emp_exp, 0) assert_almost_equal(pval, self.pval_asym_exp, 3)
def test_see_also_trailing_comma_warning(): warnings.filterwarnings('error') with assert_warns(Warning, match='Unexpected comma or period after function list at index 43 of line .*'): doc6 = NumpyDocString( """ z(x,theta) See Also -------- func_f2, func_g2, :meth:`func_h2`, func_j2, : description of multiple :class:`class_j`: fubar foobar """)
def test_see_also_trailing_comma_warning(): warnings.filterwarnings('error') with assert_warns(Warning, match='Unexpected comma or period after function list at index 43 of line .*'): NumpyDocString( """ z(x,theta) See Also -------- func_f2, func_g2, :meth:`func_h2`, func_j2, : description of multiple :class:`class_j`: fubar foobar """)
def test_old_radius_api_warning(self): with assert_warns(DeprecationWarning): SphericalVoronoi(self.points, None)
def test_old_center_api_warning(self): with assert_warns(DeprecationWarning): sv = SphericalVoronoi(self.points, None, None)