(self)
| 605 | self.check_arrays(arr, b) |
| 606 | |
| 607 | def test_write_csv_escaped(self): |
| 608 | outfile = self.test_work_path / "solutionarray_escaped.csv" |
| 609 | outfile.unlink(missing_ok=True) |
| 610 | |
| 611 | extra = {"foo": range(7), "bar": range(7), "spam,eggs": "a,b,"} |
| 612 | arr = ct.SolutionArray(self.gas, 7, extra=extra) |
| 613 | arr.TPX = np.linspace(300, 1000, 7), 2e5, "H2:0.5, O2:0.4" |
| 614 | arr.equilibrate("HP") |
| 615 | arr.save(outfile, basis="mass") |
| 616 | |
| 617 | with open(outfile, "r") as fid: |
| 618 | header = fid.readline() |
| 619 | assert "Y_H2" in header.split(",") |
| 620 | |
| 621 | b = ct.SolutionArray(self.gas) |
| 622 | if _pandas is None: |
| 623 | with pytest.raises(ValueError): |
| 624 | # np.genfromtxt does not support escaped characters |
| 625 | b.read_csv(outfile) |
| 626 | return |
| 627 | |
| 628 | b.read_csv(outfile) |
| 629 | self.check_arrays(arr, b) |
| 630 | |
| 631 | df = _pandas.read_csv(outfile) |
| 632 | b.from_pandas(df) |
| 633 | self.check_arrays(arr, b) |
| 634 | |
| 635 | def test_write_csv_exceptions(self): |
| 636 | outfile = self.test_work_path / f"solutionarray_invalid.csv" |
nothing calls this directly
no test coverage detected