# Path: praatio/data_points.py
# def open1DPointObject(fn: str) -> PointObject1D:
# def open2DPointObject(fn: str) -> PointObject2D:
# def _parseNormalHeader(fn: str) -> Tuple[str, str, float, float]:
# def _getNextValue(data: str, start: int) -> Tuple[str, int]:
# def _parseShortHeader(fn: str) -> Tuple[str, str, float, float]:
# 
# Path: tests/testing_utils.py
# def areTheSameFiles(fn1, fn2, fileHandler, *args):
#     """
#     Tests that files contain the same data
# 
#     If fileHandler is a textgrid file reader like
#     textgrid.openTextgrid then we can compare
#     a shortTextgrid and a longTextgrid.
# 
#     If fileHandler is readFile or io.open, etc then the raw
#     text will be compared.
#     """
#     data1 = fileHandler(fn1, *args)
#     data2 = fileHandler(fn2, *args)
# 
#     return data1 == data2
# 
# Path: tests/praatio_test_case.py
# class PraatioTestCase(unittest.TestCase):
#     def __init__(self, *args, **kargs):
#         super(PraatioTestCase, self).__init__(*args, **kargs)
# 
#         root = os.path.dirname(os.path.realpath(__file__))
#         self.dataRoot = os.path.join(root, "files")
#         self.outputRoot = os.path.join(self.dataRoot, "test_output")
# 
#     def setUp(self):
#         if not os.path.exists(self.outputRoot):
#             os.mkdir(self.outputRoot)
# 
#     def assertAllAlmostEqual(self, listA, listB):
#         for valA, valB in zip(listA, listB):
#             self.assertAlmostEqual(valA, valB)


import unittest
from os.path import join
from praatio import data_points
from tests.testing_utils import areTheSameFiles
from tests.praatio_test_case import PraatioTestCase
        fn = "mary.DurationTier"
        inputFN = join(self.dataRoot, fn)
        outputFN = join(self.outputRoot, fn)

        dt = data_points.open2DPointObject(inputFN)
        dt.save(outputFN)

        self.assertTrue(
            areTheSameFiles(inputFN, outputFN, data_points.open2DPointObject)
        )

    def test_pitch_io(self):
        """Tests for reading/writing pitch tiers"""
        fn = "mary.PitchTier"
        inputFN = join(self.dataRoot, fn)
        outputFN = join(self.outputRoot, fn)

        pp = data_points.open2DPointObject(inputFN)
        pp.save(outputFN)

        self.assertTrue(
            areTheSameFiles(inputFN, outputFN, data_points.open2DPointObject)
        )

    def test_pitch_io_long_vs_short(self):
        """Tests reading of long vs short 2d point objects"""

        shortFN = join(self.dataRoot, "mary.PitchTier")
        longFN = join(self.dataRoot, "mary_longfile.PitchTier")


# Path: praatio/data_points.py
# def open1DPointObject(fn: str) -> PointObject1D:
# def open2DPointObject(fn: str) -> PointObject2D:
# def _parseNormalHeader(fn: str) -> Tuple[str, str, float, float]:
# def _getNextValue(data: str, start: int) -> Tuple[str, int]:
# def _parseShortHeader(fn: str) -> Tuple[str, str, float, float]:
# 
# Path: tests/testing_utils.py
# def areTheSameFiles(fn1, fn2, fileHandler, *args):
#     """
#     Tests that files contain the same data
# 
#     If fileHandler is a textgrid file reader like
#     textgrid.openTextgrid then we can compare
#     a shortTextgrid and a longTextgrid.
# 
#     If fileHandler is readFile or io.open, etc then the raw
#     text will be compared.
#     """
#     data1 = fileHandler(fn1, *args)
#     data2 = fileHandler(fn2, *args)
# 
#     return data1 == data2
# 
# Path: tests/praatio_test_case.py
# class PraatioTestCase(unittest.TestCase):
#     def __init__(self, *args, **kargs):
#         super(PraatioTestCase, self).__init__(*args, **kargs)
# 
#         root = os.path.dirname(os.path.realpath(__file__))
#         self.dataRoot = os.path.join(root, "files")
#         self.outputRoot = os.path.join(self.dataRoot, "test_output")
# 
#     def setUp(self):
#         if not os.path.exists(self.outputRoot):
#             os.mkdir(self.outputRoot)
# 
#     def assertAllAlmostEqual(self, listA, listB):
#         for valA, valB in zip(listA, listB):
#             self.assertAlmostEqual(valA, valB)


# Path: tests/test_data_points.py
import unittest
from os.path import join
from praatio import data_points
from tests.testing_utils import areTheSameFiles
from tests.praatio_test_case import PraatioTestCase

        fn = "mary.DurationTier"
        inputFN = join(self.dataRoot, fn)
        outputFN = join(self.outputRoot, fn)

        dt = data_points.open2DPointObject(inputFN)
        dt.save(outputFN)

        self.assertTrue(
            areTheSameFiles(inputFN, outputFN, data_points.open2DPointObject)
        )

    def test_pitch_io(self):
        """Tests for reading/writing pitch tiers"""
        fn = "mary.PitchTier"
        inputFN = join(self.dataRoot, fn)
        outputFN = join(self.outputRoot, fn)

        pp = data_points.open2DPointObject(inputFN)
        pp.save(outputFN)

        self.assertTrue(
            areTheSameFiles(inputFN, outputFN, data_points.open2DPointObject)
        )

    def test_pitch_io_long_vs_short(self):
        """Tests reading of long vs short 2d point objects"""

        shortFN = join(self.dataRoot, "mary.PitchTier")
        longFN = join(self.dataRoot, "mary_longfile.PitchTier")


        self.assertTrue(areTheSameFiles(shortFN, longFN, data_points.open2DPointObject))