MCPcopy Create free account
hub / github.com/Cantera/cantera / test_write_csv

Method test_write_csv

test/python/test_composite.py:569–587  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

567 assert b.meta[key] == value
568
569 def test_write_csv(self):
570 outfile = self.test_work_path / "solutionarray_new.csv"
571 outfile.unlink(missing_ok=True)
572
573 arr = ct.SolutionArray(self.gas, 7)
574 arr.TPX = np.linspace(300, 1000, 7), 2e5, "H2:0.5, O2:0.4"
575 arr.equilibrate("HP")
576 arr.save(outfile, basis="mole")
577
578 with open(outfile, "r") as fid:
579 header = fid.readline()
580 assert "X_H2" in header.split(",")
581
582 b = ct.SolutionArray(self.gas)
583 b.read_csv(outfile)
584 self.check_arrays(arr, b)
585
586 with pytest.raises(ct.CanteraError, match="already exists"):
587 arr.save(outfile)
588
589 def test_write_csv_fancy(self):
590 outfile = self.test_work_path / "solutionarray_fancy.csv"

Callers

nothing calls this directly

Calls 6

equilibrateMethod · 0.95
saveMethod · 0.95
read_csvMethod · 0.95
check_arraysMethod · 0.95
SolutionArrayMethod · 0.80
splitMethod · 0.80

Tested by

no test coverage detected