# Path: MuseParse/tests/testLilyMethods/lily.py
# class Lily(unittest.TestCase):
# 
#     def setUp(self):
#         self.compile = False
#         self.wrappers = []
# 
#     def testValue(self):
#         if hasattr(self, "lilystring"):
#             if hasattr(self, "item"):
#                 self.assertEqual(self.lilystring, self.item.toLily())
# 
#     def testCompilation(self):
#         if hasattr(self, "compile") and self.compile is True:
# 
#             filepath = expanduser("~")
#             script = ''
#             if sys.platform == 'darwin':
#                 script = os.path.join(filepath, 'bin', 'lilypond')
#             filepath = os.path.join(filepath, self.name)
#             if self.compile and hasattr(self, "item"):
#                 if os.path.exists(filepath + ".pdf"):
#                     os.remove(filepath + ".pdf")
# 
#                 ly = LilypondOutput.LilypondRenderer(
#                     self.item, filepath + ".xml", script)
#                 if hasattr(self, "wrappers"):
#                     ly.run(wrappers=self.wrappers)
#                 else:
#                     ly.run()
#                 self.assertTrue(os.path.exists(filepath + ".pdf"))
# 
# Path: MuseParse/classes/ObjectHierarchy/ItemClasses/Meter.py
# class Meter(object):
# 
#     """
#     Class representing time signatures/meter markings.
# 
#     # Optional inputs
# 
#             - beats: number of beats in every bar
# 
#             - type: type of beats in every bar
# 
#             - style: indicator of how it should be displayed. Used for single digit meters using value "single-number"
#     """
# 
#     def __init__(self, **kwargs):
#         if "beats" in kwargs:
#             self.beats = kwargs["beats"]
#         if "type" in kwargs:
#             self.type = kwargs["type"]
#         if "style" in kwargs and kwargs["style"] is not None:
#             self.style = kwargs["style"]
# 
#     def __str__(self):
#         return str(self.beats) + "/" + str(self.type)
# 
#     def toLily(self):
#         val = ""
#         if hasattr(self, "style") and self.style == "single-number":
#             val += "\n\once \override Staff.TimeSignature.style = #'single-digit\n"
#         val += "\\time"
#         if hasattr(self, "beats"):
#             val += " " + str(self.beats)
#             if hasattr(self, "type"):
#                 val += "/" + str(self.type)
#             else:
#                 if self.beats <= 4:
#                     val += "/4"
#                 elif 4 < self.beats <= 8:
#                     val += "/8"
#         elif not hasattr(self, "type"):
#             val += " 4/4"
#         else:
#             val += " " + str(self.type) + "/" + str(self.type)
# 
#         return val


from MuseParse.tests.testLilyMethods.lily import Lily
from MuseParse.classes.ObjectHierarchy.ItemClasses import Meter


class testTimeSig(Lily):

    def setUp(self):
        self.item = Meter.Meter()
        self.lilystring = "\\time 4/4"


class testTimeSigBeat(Lily):

    def setUp(self):
        self.item = Meter.Meter(beats=2)
        self.lilystring = "\\time 2/4"


class testTimeSigType(Lily):

    def setUp(self):

# Path: MuseParse/tests/testLilyMethods/lily.py
# class Lily(unittest.TestCase):
# 
#     def setUp(self):
#         self.compile = False
#         self.wrappers = []
# 
#     def testValue(self):
#         if hasattr(self, "lilystring"):
#             if hasattr(self, "item"):
#                 self.assertEqual(self.lilystring, self.item.toLily())
# 
#     def testCompilation(self):
#         if hasattr(self, "compile") and self.compile is True:
# 
#             filepath = expanduser("~")
#             script = ''
#             if sys.platform == 'darwin':
#                 script = os.path.join(filepath, 'bin', 'lilypond')
#             filepath = os.path.join(filepath, self.name)
#             if self.compile and hasattr(self, "item"):
#                 if os.path.exists(filepath + ".pdf"):
#                     os.remove(filepath + ".pdf")
# 
#                 ly = LilypondOutput.LilypondRenderer(
#                     self.item, filepath + ".xml", script)
#                 if hasattr(self, "wrappers"):
#                     ly.run(wrappers=self.wrappers)
#                 else:
#                     ly.run()
#                 self.assertTrue(os.path.exists(filepath + ".pdf"))
# 
# Path: MuseParse/classes/ObjectHierarchy/ItemClasses/Meter.py
# class Meter(object):
# 
#     """
#     Class representing time signatures/meter markings.
# 
#     # Optional inputs
# 
#             - beats: number of beats in every bar
# 
#             - type: type of beats in every bar
# 
#             - style: indicator of how it should be displayed. Used for single digit meters using value "single-number"
#     """
# 
#     def __init__(self, **kwargs):
#         if "beats" in kwargs:
#             self.beats = kwargs["beats"]
#         if "type" in kwargs:
#             self.type = kwargs["type"]
#         if "style" in kwargs and kwargs["style"] is not None:
#             self.style = kwargs["style"]
# 
#     def __str__(self):
#         return str(self.beats) + "/" + str(self.type)
# 
#     def toLily(self):
#         val = ""
#         if hasattr(self, "style") and self.style == "single-number":
#             val += "\n\once \override Staff.TimeSignature.style = #'single-digit\n"
#         val += "\\time"
#         if hasattr(self, "beats"):
#             val += " " + str(self.beats)
#             if hasattr(self, "type"):
#                 val += "/" + str(self.type)
#             else:
#                 if self.beats <= 4:
#                     val += "/4"
#                 elif 4 < self.beats <= 8:
#                     val += "/8"
#         elif not hasattr(self, "type"):
#             val += " 4/4"
#         else:
#             val += " " + str(self.type) + "/" + str(self.type)
# 
#         return val


# Path: MuseParse/tests/testLilyMethods/testMeter.py
from MuseParse.tests.testLilyMethods.lily import Lily
from MuseParse.classes.ObjectHierarchy.ItemClasses import Meter



class testTimeSig(Lily):

    def setUp(self):
        self.item = Meter.Meter()
        self.lilystring = "\\time 4/4"


class testTimeSigBeat(Lily):

    def setUp(self):
        self.item = Meter.Meter(beats=2)
        self.lilystring = "\\time 2/4"


class testTimeSigType(Lily):

    def setUp(self):

        self.item = Meter.Meter(type=2)