# Path: geomeppy/io/obj.py
# def export_to_obj(idf, fname=None, mtllib=None):
#     # type: (IDF, Optional[str], Optional[str]) -> None
#     """Export an OBJ file representation of the IDF.
# 
#     This can be used for viewing in tools which support the .obj format.
# 
#     :param idf: An IDF to export.
#     :param fname: A filename for the .obj file. If None we try to base it on IDF.idfname and change the filetype.
#     :param mtllib: The name of a .mtl file to be referenced from the .obj file. If None, we use default.mtl.
#     """
#     if not fname:
#         name, _ext = os.path.splitext(idf.idfname)
#         fname = "%s.obj" % name
#     if not mtllib:
#         name, _ext = os.path.splitext(fname)
#         mtllib = "%s.mtl" % name
#         shutil.copy(os.path.join(THIS_DIR, "default.mtl"), mtllib)
#     obj_writer = ObjWriter()
#     surfaces = idf.getsurfaces()
#     subsurfaces = idf.getsubsurfaces()
#     shading_surfaces = idf.getshadingsurfaces()
#     obj_writer.from_surfaces(surfaces, subsurfaces, shading_surfaces)
#     obj_writer.write(fname, mtllib)


import os
from geomeppy.io.obj import export_to_obj

EXAMPLES_DIR = "C:/EnergyPlusV9-1-0/ExampleFiles"


def test_export_to_obj(base_idf):
    export_to_obj(base_idf, "test.obj")
    assert os.path.isfile("test.obj")

# Path: geomeppy/io/obj.py
# def export_to_obj(idf, fname=None, mtllib=None):
#     # type: (IDF, Optional[str], Optional[str]) -> None
#     """Export an OBJ file representation of the IDF.
# 
#     This can be used for viewing in tools which support the .obj format.
# 
#     :param idf: An IDF to export.
#     :param fname: A filename for the .obj file. If None we try to base it on IDF.idfname and change the filetype.
#     :param mtllib: The name of a .mtl file to be referenced from the .obj file. If None, we use default.mtl.
#     """
#     if not fname:
#         name, _ext = os.path.splitext(idf.idfname)
#         fname = "%s.obj" % name
#     if not mtllib:
#         name, _ext = os.path.splitext(fname)
#         mtllib = "%s.mtl" % name
#         shutil.copy(os.path.join(THIS_DIR, "default.mtl"), mtllib)
#     obj_writer = ObjWriter()
#     surfaces = idf.getsurfaces()
#     subsurfaces = idf.getsubsurfaces()
#     shading_surfaces = idf.getshadingsurfaces()
#     obj_writer.from_surfaces(surfaces, subsurfaces, shading_surfaces)
#     obj_writer.write(fname, mtllib)


# Path: tests/test_obj.py
import os
from geomeppy.io.obj import export_to_obj


EXAMPLES_DIR = "C:/EnergyPlusV9-1-0/ExampleFiles"


def test_export_to_obj(base_idf):
    export_to_obj(base_idf, "test.obj")
    assert os.path.isfile("test.obj")

    assert os.path.isfile("test.mtl")