Closed
Description
There is an error in python3.12 in the analysis test_graph at
https://github.com/materialsproject/pymatgen/blob/940eb60cbc2848530b2560f75d56298a3c3f714c/tests/analysis/test_graphs.py#L376C9-L376C76
Output running tests is
_________________________ TestStructureGraph.test_draw _________________________
self = <tests.analysis.test_graphs.TestStructureGraph testMethod=test_draw>
@pytest.mark.skipif(
pygraphviz is None or not (which("neato") and which("fdp")),
reason="graphviz executables not present",
)
def test_draw(self):
# draw MoS2 graph
self.mos2_sg.draw_graph_to_file(f"{self.tmp_path}/MoS2_single.pdf", image_labels=True, hide_image_edges=False)
mos2_sg = self.mos2_sg * (9, 9, 1)
mos2_sg.draw_graph_to_file(f"{self.tmp_path}/MoS2.pdf", algo="neato")
# draw MoS2 graph that's been successively multiplied
mos2_sg_2 = self.mos2_sg * (3, 3, 1)
mos2_sg_2 = mos2_sg_2 * (3, 3, 1)
mos2_sg_2.draw_graph_to_file(f"{self.tmp_path}/MoS2_twice_mul.pdf", algo="neato", hide_image_edges=True)
# draw MoS2 graph that's generated from a pre-multiplied Structure
mos2_sg_premul = StructureGraph.from_local_env_strategy(self.structure * (3, 3, 1), MinimumDistanceNN())
mos2_sg_premul.draw_graph_to_file(f"{self.tmp_path}/MoS2_premul.pdf", algo="neato", hide_image_edges=True)
# draw graph for a square lattice
self.square_sg.draw_graph_to_file(f"{self.tmp_path}/square_single.pdf", hide_image_edges=False)
square_sg = self.square_sg * (5, 5, 1)
square_sg.draw_graph_to_file(f"{self.tmp_path}/square.pdf", algo="neato", image_labels=True, node_labels=False)
# draw graph for a body-centered square lattice
self.bc_square_sg.draw_graph_to_file(f"{self.tmp_path}/bc_square_single.pdf", hide_image_edges=False)
bc_square_sg = self.bc_square_sg * (9, 9, 1)
bc_square_sg.draw_graph_to_file(f"{self.tmp_path}/bc_square.pdf", algo="neato", image_labels=False)
# draw graph for a body-centered square lattice defined in an alternative way
self.bc_square_sg_r.draw_graph_to_file(f"{self.tmp_path}/bc_square_r_single.pdf", hide_image_edges=False)
bc_square_sg_r = self.bc_square_sg_r * (9, 9, 1)
bc_square_sg_r.draw_graph_to_file(f"{self.tmp_path}/bc_square_r.pdf", algo="neato", image_labels=False)
# ensure PDF files were created
> pdfs = {path.split("/") for path in glob(f"{self.tmp_path}/*.pdf")}
E TypeError: unhashable type: 'list'
/build/pymatgen/.pybuild/test_python3.12/tests/analysis/test_graphs.py:376: TypeError
But the error is trivial to reproduce (if there are pdf files in the directory):
$ touch 1.pdf 2.pdf
$ python3 -c 'from glob import glob; pdfs = {path.split("/") for path in glob("./*.pdf")}; print(pdfs)'
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: unhashable type: 'list'
Metadata
Metadata
Assignees
Labels
No labels