# Path: praatio/textgrid.py
# def openTextgrid(
#     fnFullPath: str,
#     includeEmptyIntervals: bool,
#     reportingMode: Literal["silence", "warning", "error"] = "warning",
#     duplicateNamesMode: Literal["error", "rename"] = "error",
# ) -> Textgrid:
# def _dictionaryToTg(
#     tgAsDict: dict, reportingMode: Literal["silence", "warning", "error"]
# ) -> Textgrid:
# 
# Path: praatio/utilities/constants.py
# INTERVAL_TIER: Final = "IntervalTier"
# POINT_TIER: Final = "TextTier"
# MIN_INTERVAL_LENGTH: Final = 0.00000001  # Arbitrary threshold
#     LONG_TEXTGRID: Final = "long_textgrid"
#     SHORT_TEXTGRID: Final = "short_textgrid"
#     JSON: Final = "json"
#     POINT: Final = "PointProcess"
#     PITCH: Final = "PitchTier"
#     DURATION: Final = "DurationTier"
#     STRICT: Final = "strict"
#     LAX: Final = "lax"
#     TRUNCATED: Final = "truncated"
#     SILENCE: Final = "silence"
#     WARNING: Final = "warning"
#     ERROR: Final = "error"
#     REPLACE: Final = "replace"
#     MERGE: Final = "merge"
#     ERROR: Final = "error"
#     STRETCH: Final = "stretch"
#     SPLIT: Final = "split"
#     NO_CHANGE: Final = "no_change"
#     ERROR: Final = "error"
#     TRUNCATE: Final = "truncate"
#     CATEGORICAL: Final = "categorical"
#     ERROR: Final = "error"
#     ERROR: Final = "error"
#     RENAME: Final = "rename"
# class Interval(namedtuple("Interval", ["start", "end", "label"])):
# class Point(namedtuple("Point", ["time", "label"])):
# class TextgridFormats:
# class DataPointTypes:
# class CropCollision:
# class ErrorReportingMode:
# class IntervalCollision:
# class WhitespaceCollision:
# class EraseCollision:
# class DuplicateNames:
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __eq__(self, other):
#     def __ne__(self, other):


import unittest
import os
from os.path import join
from praatio import textgrid
from praatio.utilities import constants

        cwd = os.path.dirname(os.path.realpath(__file__))
        root = os.path.split(cwd)[0]
        self.dataRoot = join(root, "files")
        self.outputRoot = join(self.dataRoot, "io_test_output")

    def test_openTextgrid(self):
        tgFN = join(self.dataRoot, "mary.TextGrid")

        tg = textgrid.openTextgrid(tgFN, False)
        tier = tg.tierDict["word"]
        numEntries = len(tier.entryList)

        self.assertEqual(4, numEntries)

    def test_openTextgrid_with_include_empty_intervals_as_true(self):
        tgFN = join(self.dataRoot, "mary.TextGrid")

        tg = textgrid.openTextgrid(tgFN, True)
        tier = tg.tierDict["word"]
        numEntries = len(tier.entryList)

        self.assertEqual(6, numEntries)

    def test_shift(self):
        """Testing adjustments to textgrid times"""
        tgFN = join(self.dataRoot, "mary.TextGrid")

        tg = textgrid.openTextgrid(tgFN, False)
        shiftedTG = tg.editTimestamps(0.1, constants.ErrorReportingMode.ERROR)

# Path: praatio/textgrid.py
# def openTextgrid(
#     fnFullPath: str,
#     includeEmptyIntervals: bool,
#     reportingMode: Literal["silence", "warning", "error"] = "warning",
#     duplicateNamesMode: Literal["error", "rename"] = "error",
# ) -> Textgrid:
# def _dictionaryToTg(
#     tgAsDict: dict, reportingMode: Literal["silence", "warning", "error"]
# ) -> Textgrid:
# 
# Path: praatio/utilities/constants.py
# INTERVAL_TIER: Final = "IntervalTier"
# POINT_TIER: Final = "TextTier"
# MIN_INTERVAL_LENGTH: Final = 0.00000001  # Arbitrary threshold
#     LONG_TEXTGRID: Final = "long_textgrid"
#     SHORT_TEXTGRID: Final = "short_textgrid"
#     JSON: Final = "json"
#     POINT: Final = "PointProcess"
#     PITCH: Final = "PitchTier"
#     DURATION: Final = "DurationTier"
#     STRICT: Final = "strict"
#     LAX: Final = "lax"
#     TRUNCATED: Final = "truncated"
#     SILENCE: Final = "silence"
#     WARNING: Final = "warning"
#     ERROR: Final = "error"
#     REPLACE: Final = "replace"
#     MERGE: Final = "merge"
#     ERROR: Final = "error"
#     STRETCH: Final = "stretch"
#     SPLIT: Final = "split"
#     NO_CHANGE: Final = "no_change"
#     ERROR: Final = "error"
#     TRUNCATE: Final = "truncate"
#     CATEGORICAL: Final = "categorical"
#     ERROR: Final = "error"
#     ERROR: Final = "error"
#     RENAME: Final = "rename"
# class Interval(namedtuple("Interval", ["start", "end", "label"])):
# class Point(namedtuple("Point", ["time", "label"])):
# class TextgridFormats:
# class DataPointTypes:
# class CropCollision:
# class ErrorReportingMode:
# class IntervalCollision:
# class WhitespaceCollision:
# class EraseCollision:
# class DuplicateNames:
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __eq__(self, other):
#     def __ne__(self, other):


# Path: tests/integration/test_tg.py
import unittest
import os
from os.path import join
from praatio import textgrid
from praatio.utilities import constants


        cwd = os.path.dirname(os.path.realpath(__file__))
        root = os.path.split(cwd)[0]
        self.dataRoot = join(root, "files")
        self.outputRoot = join(self.dataRoot, "io_test_output")

    def test_openTextgrid(self):
        tgFN = join(self.dataRoot, "mary.TextGrid")

        tg = textgrid.openTextgrid(tgFN, False)
        tier = tg.tierDict["word"]
        numEntries = len(tier.entryList)

        self.assertEqual(4, numEntries)

    def test_openTextgrid_with_include_empty_intervals_as_true(self):
        tgFN = join(self.dataRoot, "mary.TextGrid")

        tg = textgrid.openTextgrid(tgFN, True)
        tier = tg.tierDict["word"]
        numEntries = len(tier.entryList)

        self.assertEqual(6, numEntries)

    def test_shift(self):
        """Testing adjustments to textgrid times"""
        tgFN = join(self.dataRoot, "mary.TextGrid")

        tg = textgrid.openTextgrid(tgFN, False)
        shiftedTG = tg.editTimestamps(0.1, constants.ErrorReportingMode.ERROR)

        unshiftedTG = shiftedTG.editTimestamps(-0.1, constants.ErrorReportingMode.ERROR)