def test_disordered_formula(self): disordered_struct = Structure([[10, 0, 0], [0, 10, 0], [0, 0, 10]], [{'Cu': 0.25, 'Au': 0.75}], [[0, 0, 0]]) formula_plain = disordered_formula(disordered_struct, fmt='plain') formula_latex = disordered_formula(disordered_struct, fmt='LaTeX') formula_html = disordered_formula(disordered_struct, fmt='HTML') self.assertEqual(formula_plain, 'CuxAu1-x x=0.25') self.assertEqual(formula_latex, 'Cu_{x}Au_{1-x} x=0.25') self.assertEqual(formula_html, 'Cu<sub>x</sub>Au<sub>1-x</sub> x=0.25')
def test_disordered_formula(self): disordered_struct = Structure( [[10, 0, 0], [0, 10, 0], [0, 0, 10]], [{"Cu": 0.25, "Au": 0.75}], [[0, 0, 0]], ) formula_plain = disordered_formula(disordered_struct, fmt="plain") formula_latex = disordered_formula(disordered_struct, fmt="LaTeX") formula_html = disordered_formula(disordered_struct, fmt="HTML") self.assertEqual(formula_plain, "CuxAu1-x x=0.25") self.assertEqual(formula_latex, "Cu_{x}Au_{1-x} x=0.25") self.assertEqual(formula_html, "Cu<sub>x</sub>Au<sub>1-x</sub> x=0.25")