def test_set_phase_color(self, color, color_alias, color_rgb, fails): p = Phase() if fails: with pytest.raises(ValueError, match="Invalid RGBA argument: "): p.color = color else: p.color = color assert p.color == color_alias assert np.allclose(p.color_rgb, color_rgb, atol=1e-6)
def test_deepcopy_phase(self): p = Phase(name="al", space_group=225, color="C1") p2 = p.deepcopy() desired_p_repr = ( "<name: al. space group: Fm-3m. point group: m-3m. proper point group: 432." " color: tab:orange>") assert p.__repr__() == desired_p_repr p.name = "austenite" p.space_group = 229 p.color = "C2" new_desired_p_repr = ( "<name: austenite. space group: Im-3m. point group: m-3m. proper point " "group: 432. color: tab:green>") assert p.__repr__() == new_desired_p_repr assert p2.__repr__() == desired_p_repr