@@ -88,30 +88,40 @@ def test__hashSymOpList(self):
8888
8989 def test_spacegroup_representation (self ):
9090 """Verify SpaceGroup.__repr__()."""
91- numbers = [1 , 3 , 16 , 75 , 143 , 168 , 229 ]
92- short_names = ["P1" , "P2" , "P222" , "P4" , "P3" , "P6" , "Im-3m" ]
93- systems = [
94- "Triclinic" ,
95- "Monoclinic" ,
96- "Orthorhombic" ,
97- "Tetragonal" ,
98- "Trigonal" ,
99- "Hexagonal" ,
100- "Cubic" ,
101- ]
102- n_symmetry_matrices = [1 , 2 , 4 , 4 , 3 , 6 , 96 ]
103- n_point_symmetry_matrices = [1 , 2 , 4 , 4 , 3 , 6 , 48 ]
104- sg_dict = dict (zip (
105- numbers ,
106- zip (short_names , systems , n_symmetry_matrices , n_point_symmetry_matrices )
107- ))
108- for key , value in sg_dict .items ():
109- sg = GetSpaceGroup (key )
110- expected_str = (
111- "SpaceGroup #%i (%s, %s). Symmetry matrices: %i, "
112- "point sym. matr.: %i"
113- ) % ((key ,) + value )
114- self .assertEqual (sg .__repr__ (), expected_str )
91+ self .assertEqual (
92+ repr (GetSpaceGroup (1 )),
93+ "SpaceGroup #1 (P1, Triclinic). Symmetry matrices: 1, point sym. matr.: 1"
94+ )
95+ self .assertEqual (
96+ repr (GetSpaceGroup (3 )),
97+ "SpaceGroup #3 (P2, Monoclinic). Symmetry matrices: 2, point sym. matr.: 2"
98+ )
99+ self .assertEqual (
100+ repr (GetSpaceGroup (16 )),
101+ (
102+ "SpaceGroup #16 (P222, Orthorhombic). Symmetry matrices: 4, point sym. "
103+ "matr.: 4"
104+ )
105+ )
106+ self .assertEqual (
107+ repr (GetSpaceGroup (75 )),
108+ "SpaceGroup #75 (P4, Tetragonal). Symmetry matrices: 4, point sym. matr.: 4"
109+ )
110+ self .assertEqual (
111+ repr (GetSpaceGroup (143 )),
112+ "SpaceGroup #143 (P3, Trigonal). Symmetry matrices: 3, point sym. matr.: 3"
113+ )
114+ self .assertEqual (
115+ repr (GetSpaceGroup (168 )),
116+ "SpaceGroup #168 (P6, Hexagonal). Symmetry matrices: 6, point sym. matr.: 6"
117+ )
118+ self .assertEqual (
119+ repr (GetSpaceGroup (229 )),
120+ (
121+ "SpaceGroup #229 (Im-3m, Cubic). Symmetry matrices: 96, point sym. "
122+ "matr.: 48"
123+ )
124+ )
115125 return
116126
117127# End of class TestRoutines
0 commit comments