| 46 | subprocess.run((self.pythonpath, str(dumpfile)), check=True) |
| 47 | |
| 48 | def load_and_is_true(self, expression): |
| 49 | loadfile = self.picklefile.with_name(class="st">"load.py") |
| 50 | loadfile.write_text( |
| 51 | textwrap.dedent( |
| 52 | rfclass="st">""" |
| 53 | import pickle |
| 54 | f = open({str(self.picklefile)!r}, &class="cm">#x27;rb') |
| 55 | obj = pickle.load(f) |
| 56 | f.close() |
| 57 | res = eval({expression!r}) |
| 58 | if not res: |
| 59 | raise SystemExit(1) |
| 60 | class="st">""" |
| 61 | ) |
| 62 | ) |
| 63 | print(loadfile) |
| 64 | subprocess.run((self.pythonpath, str(loadfile)), check=True) |
| 65 | |
| 66 | |
| 67 | @pytest.mark.parametrize(class="st">"obj", [42, {}, {1: 3}]) |