(self, mode)
| 759 | == ["generator", "cantera-version", "git-commit", "date"]) |
| 760 | |
| 761 | def run_overwrite(self, mode): |
| 762 | outfile = self.test_work_path / f"solutionarray_overwrite.{mode}" |
| 763 | outfile2 = self.test_work_path / f"solutionarray_fresh.{mode}" |
| 764 | outfile.unlink(missing_ok=True) |
| 765 | outfile2.unlink(missing_ok=True) |
| 766 | |
| 767 | states = ct.SolutionArray(self.gas, 8) |
| 768 | states.TPX = np.linspace(300, 1000, 8), 2e5, 'H2:0.5, O2:0.4' |
| 769 | states.save(outfile, "arr") |
| 770 | |
| 771 | b = ct.SolutionArray(self.gas) |
| 772 | b.restore(outfile, "arr") |
| 773 | assert b.shape == states.shape |
| 774 | assert b.T[-1] == states.T[-1] |
| 775 | |
| 776 | states.equilibrate('HP') |
| 777 | |
| 778 | with pytest.raises(ct.CanteraError, match="use 'overwrite' argument"): |
| 779 | states.save(outfile, "arr") |
| 780 | |
| 781 | states.save(outfile, "arr", overwrite=True) |
| 782 | states.save(outfile2, "arr") |
| 783 | |
| 784 | c = ct.SolutionArray(self.gas) |
| 785 | c.restore(outfile, "arr") |
| 786 | assert c.shape == states.shape |
| 787 | assert c.T[-1] == states.T[-1] |
| 788 | |
| 789 | return outfile, outfile2 |
| 790 | |
| 791 | |
| 792 | @pytest.fixture(scope='function') |
no test coverage detected