def __enter__(self): """Load PDF in memory.""" global _selected_pdf global _context_pdf if _selected_pdf == str(self): _context_pdf = str(self) return if _context_pdf is not None and _context_pdf != str(self): raise RuntimeError("Contrdicting PDF scope. " "Was %s and trying to enter %s" % (_context_pdf, self)) _selected_pdf = str(self) _context_pdf = str(self) applwrap.initpdf(self.name)
def test_bad_values(self): with self.assertRaises(ValueError): applwrap.initobs("patata") with self.assertRaises(ValueError): applwrap.initpdf("patata")