# Path: phon/io_tools/read/read_from_abaqus_inp.py
# def read_from_abaqus_inp(filename, verbose=0):
#     """
#     Reads a mesh file in Abaqus .inp format and stores it into a
#     Mesh class object.
# 
#     :param filename: The name of the file from where to read the mesh from.
#     :type filename: string
#     :param verbose: Determines what level of print out to the console.
#     :type verbose: 0, 1 or 2
#     :return: A mesh class containing the read mesh objects.
#     :rtype: :class:`phon.mesh_objects.mesh()`
#     :raises ReadInpFileError: If specific syntax error are found.
# 
#     """
# 
#     with open(filename, "rU") as f:
# 
#         # Read mesh objects
#         num_elems = 0
#         mesh = Mesh("temp_name")
#         while True:
#             start_of_line = f.tell()
#             keyword = f.readline()
#             if f.readline() == "":
#                 break
#             keyword = keyword.strip().split(",")[0]
#             f.seek(start_of_line)
# 
#             if keyword.lower() == "*part":
#                 _read_part(f, mesh, verbose)
#             elif keyword.lower() == "*node":
#                 _read_nodes(f, mesh, verbose)
#             elif keyword.lower() == "*element":
#                 num_elems += _read_elements(f, mesh, num_elems, verbose)
#             elif keyword.lower() == "*elset":
#                 _read_element_set(f, mesh, verbose)
#             elif keyword.lower() == "*nset":
#                 _read_node_set(f, mesh, verbose)
#             elif keyword.lower() == "*end part":
#                 break
#             else:
#                 f.readline()
# 
#                 continue
# 
#         f.close()
# 
#         return mesh
# 
# Path: phon/io_tools/read/read_from_abaqus_inp.py
# def to_number(number):
#     """
#     Converts a string to a int if possible, else a float.
# 
#     :param number: The string to convert to a number
#     :type number: string
# 
#     :return: The converted number
#     :rtype: : int or float depending on the format of the string
# 
#     """
#     try:
#         return int(number)
#     except ValueError:
#         return float(number)


import unittest
import os
from phon.io_tools.read.read_from_abaqus_inp import read_from_abaqus_inp
from phon.io_tools.read.read_from_abaqus_inp import to_number
            self.assertTrue((mesh.elements[686].elem_type == "C3D4") or
                            (mesh.elements[686].elem_type == "C3D10"))
            self.assertEqual(mesh.elements[685].vertices, [44, 155, 61, 154])
            self.assertEqual(mesh.elements[1683].vertices, [283, 127, 246, 284])

            self.assertEqual(len(mesh.node_sets), 44)

        # We need double tests due for strings due to Abaqus capitalizing things.

        # Test element sets
        self.assertEqual(len(self.mesh.element_sets), 66)
        self.assertEqual(self.mesh.element_sets["face22"].name, "face22")
        self.assertEqual(self.mesh.element_sets["face36"].ids[3], 434)
        self.assertEqual(self.mesh_aba.element_sets["face22"].name, "face22")
        self.assertEqual(self.mesh_aba.element_sets["face36"].ids[3], 434)

        self.assertEqual(self.mesh.element_sets["poly6"].name, "poly6")
        self.assertEqual(self.mesh.element_sets["poly10"].ids[8], 1584)
        self.assertEqual(self.mesh_aba.element_sets["poly6"].name, "poly6")
        self.assertEqual(self.mesh_aba.element_sets["poly10"].ids[8], 1584)

        # Test node sets
        self.assertEqual(len(self.mesh.node_sets["z0"].ids), 44)
        self.assertEqual(self.mesh.node_sets["x1z1body"].ids[1], 116)
        self.assertEqual(self.mesh.node_sets["x1y0z1"].ids, [32])
        self.assertEqual(len(self.mesh_aba.node_sets["z0"].ids), 44)
        self.assertEqual(self.mesh_aba.node_sets["x1z1body"].ids[1], 116)
        self.assertEqual(self.mesh_aba.node_sets["x1y0z1"].ids, [32])

    def test_to_number(self):

# Path: phon/io_tools/read/read_from_abaqus_inp.py
# def read_from_abaqus_inp(filename, verbose=0):
#     """
#     Reads a mesh file in Abaqus .inp format and stores it into a
#     Mesh class object.
# 
#     :param filename: The name of the file from where to read the mesh from.
#     :type filename: string
#     :param verbose: Determines what level of print out to the console.
#     :type verbose: 0, 1 or 2
#     :return: A mesh class containing the read mesh objects.
#     :rtype: :class:`phon.mesh_objects.mesh()`
#     :raises ReadInpFileError: If specific syntax error are found.
# 
#     """
# 
#     with open(filename, "rU") as f:
# 
#         # Read mesh objects
#         num_elems = 0
#         mesh = Mesh("temp_name")
#         while True:
#             start_of_line = f.tell()
#             keyword = f.readline()
#             if f.readline() == "":
#                 break
#             keyword = keyword.strip().split(",")[0]
#             f.seek(start_of_line)
# 
#             if keyword.lower() == "*part":
#                 _read_part(f, mesh, verbose)
#             elif keyword.lower() == "*node":
#                 _read_nodes(f, mesh, verbose)
#             elif keyword.lower() == "*element":
#                 num_elems += _read_elements(f, mesh, num_elems, verbose)
#             elif keyword.lower() == "*elset":
#                 _read_element_set(f, mesh, verbose)
#             elif keyword.lower() == "*nset":
#                 _read_node_set(f, mesh, verbose)
#             elif keyword.lower() == "*end part":
#                 break
#             else:
#                 f.readline()
# 
#                 continue
# 
#         f.close()
# 
#         return mesh
# 
# Path: phon/io_tools/read/read_from_abaqus_inp.py
# def to_number(number):
#     """
#     Converts a string to a int if possible, else a float.
# 
#     :param number: The string to convert to a number
#     :type number: string
# 
#     :return: The converted number
#     :rtype: : int or float depending on the format of the string
# 
#     """
#     try:
#         return int(number)
#     except ValueError:
#         return float(number)


# Path: test/test_read_from_neper_inp.py
import unittest
import os
from phon.io_tools.read.read_from_abaqus_inp import read_from_abaqus_inp
from phon.io_tools.read.read_from_abaqus_inp import to_number

            self.assertTrue((mesh.elements[686].elem_type == "C3D4") or
                            (mesh.elements[686].elem_type == "C3D10"))
            self.assertEqual(mesh.elements[685].vertices, [44, 155, 61, 154])
            self.assertEqual(mesh.elements[1683].vertices, [283, 127, 246, 284])

            self.assertEqual(len(mesh.node_sets), 44)

        # We need double tests due for strings due to Abaqus capitalizing things.

        # Test element sets
        self.assertEqual(len(self.mesh.element_sets), 66)
        self.assertEqual(self.mesh.element_sets["face22"].name, "face22")
        self.assertEqual(self.mesh.element_sets["face36"].ids[3], 434)
        self.assertEqual(self.mesh_aba.element_sets["face22"].name, "face22")
        self.assertEqual(self.mesh_aba.element_sets["face36"].ids[3], 434)

        self.assertEqual(self.mesh.element_sets["poly6"].name, "poly6")
        self.assertEqual(self.mesh.element_sets["poly10"].ids[8], 1584)
        self.assertEqual(self.mesh_aba.element_sets["poly6"].name, "poly6")
        self.assertEqual(self.mesh_aba.element_sets["poly10"].ids[8], 1584)

        # Test node sets
        self.assertEqual(len(self.mesh.node_sets["z0"].ids), 44)
        self.assertEqual(self.mesh.node_sets["x1z1body"].ids[1], 116)
        self.assertEqual(self.mesh.node_sets["x1y0z1"].ids, [32])
        self.assertEqual(len(self.mesh_aba.node_sets["z0"].ids), 44)
        self.assertEqual(self.mesh_aba.node_sets["x1z1body"].ids[1], 116)
        self.assertEqual(self.mesh_aba.node_sets["x1y0z1"].ids, [32])

    def test_to_number(self):

        self.assertEqual(to_number("1.3"), 1.3)