Exemplo n.º 1
0
    def test_get_vendor_columns(self, expected_vendor, expected_columns,
                                vendor_header, temp_ang_file):
        expected_columns = ["euler1", "euler2", "euler3", "x", "y"
                            ] + expected_columns
        n_cols_file = len(expected_columns)

        temp_ang_file.write(vendor_header)
        temp_ang_file.close()
        header = _get_header(open(temp_ang_file.name))
        vendor, column_names = _get_vendor_columns(header, n_cols_file)

        assert vendor == expected_vendor
        assert column_names == expected_columns
Exemplo n.º 2
0
 def test_get_vendor_columns_unknown(self, temp_ang_file, n_cols_file):
     temp_ang_file.write("Look at me!\nI'm Mr. .ang file!\n")
     temp_ang_file.close()
     header = _get_header(open(temp_ang_file.name))
     with pytest.warns(UserWarning, match=f"Number of columns, {n_cols_file}, "):
         vendor, column_names = _get_vendor_columns(header, n_cols_file)
         assert vendor == "unknown"
         expected_columns = [
             "euler1",
             "euler2",
             "euler3",
             "x",
             "y",
             "unknown1",
             "unknown2",
             "phase_id",
         ] + ["unknown" + str(i + 3) for i in range(n_cols_file - 8)]
         assert column_names == expected_columns
Exemplo n.º 3
0
 def test_get_header(self, temp_ang_file):
     temp_ang_file.write(ANGFILE_ASTAR_HEADER)
     temp_ang_file.close()
     assert _get_header(open(temp_ang_file.name)) == [
         "# File created from ACOM RES results",
         "# ni-dislocations.res",
         "#     ".rstrip(),
         "#     ".rstrip(),
         "# MaterialName      Nickel",
         "# Formula",
         "# Symmetry          43",
         "# LatticeConstants  3.520  3.520  3.520  90.000  90.000  90.000",
         "# NumberFamilies    4",
         "# hklFamilies       1  1  1 1 0.000000",
         "# hklFamilies       2  0  0 1 0.000000",
         "# hklFamilies       2  2  0 1 0.000000",
         "# hklFamilies       3  1  1 1 0.000000",
         "#",
         "# GRID: SqrGrid#",
     ]