def test_info_deprecation_2(self): reset_hftools_warnings() self.assertHFToolsDeprecationWarning(aobj.hfarray, 1, info=()) with warnings.catch_warnings(): warnings.resetwarnings() warnings.simplefilter("ignore", HFToolsDeprecationWarning) aobj.hfarray(1, info=())
def _helper_false(self, dims): reset_hftools_warnings() self.assertHFToolsDeprecationWarning(info_has_complex, dims) with warnings.catch_warnings(): warnings.resetwarnings() warnings.simplefilter("ignore", HFToolsDeprecationWarning) self.assertFalse(info_has_complex(dims))
def test_info_index_deprecated(self): reset_hftools_warnings() x = aobj.hfarray([1,2], dims=(aobj.DimSweep("a", 2),)) self.assertHFToolsDeprecationWarning(x.info_index, "a", aobj.DimSweep) with warnings.catch_warnings(): warnings.resetwarnings() warnings.simplefilter("ignore", HFToolsDeprecationWarning) x.info_index("a", aobj.DimSweep)
def test_set_info_deprecation_1(self): a = aobj.hfarray(1) reset_hftools_warnings() self.assertHFToolsDeprecationWarning(setattr, a, "info", ()) with warnings.catch_warnings(): warnings.resetwarnings() warnings.simplefilter("ignore", HFToolsDeprecationWarning) a.info = ()
def test_info_deprecation_1(self): a = aobj.hfarray(1) reset_hftools_warnings() self.assertHFToolsDeprecationWarning(lambda x: x.info, a) with warnings.catch_warnings(): warnings.resetwarnings() warnings.simplefilter("ignore", HFToolsDeprecationWarning) a.info
def test_2(self): d = self.d reset_hftools_warnings() self.assertHFToolsWarning(d.sort, DimSweep("NONE", [1, 2, 3])) with warnings.catch_warnings() as log: warnings.resetwarnings() warnings.simplefilter("ignore", HFToolsWarning) d.sort(DimSweep("NONE", [1, 2, 3])) reset_hftools_warnings()
def test_intersection_1(self): d = DataBlock() fi = DimSweep("Freq[Hz]", [10, 20, 30, 40, 50]) gi = DimSweep("g", 4) dims = (fi, gi) d["a"] = hfarray([[1, 2, 3, 4]] * 5, dims=dims, outputformat="%.5f", unit="V") x = DimSweep("Freq", [20, 40]) reset_hftools_warnings() self.assertHFToolsWarning(d.filter, hfarray(x)) with warnings.catch_warnings() as log: warnings.resetwarnings() warnings.simplefilter("ignore", HFToolsWarning) d.filter(hfarray(x)) reset_hftools_warnings()
def test_info_deprecation_3(self): reset_hftools_warnings() with warnings.catch_warnings(): warnings.resetwarnings() warnings.simplefilter("ignore", HFToolsDeprecationWarning) self.assertRaises(ValueError, aobj.hfarray, 1, info=(), dims=())