# Path: l2tscaffolder/definitions/interface.py
# class ScaffolderDefinition:
#   NAME = definitions.DEFINITION_UNDEFINED
#   def ValidatePath(self, root_path: str) -> bool:
# 
# Path: l2tscaffolder/definitions/manager.py
# class DefinitionManager:
#   def DeregisterDefinition(
#       cls, definition_class: Type[interface.ScaffolderDefinition]):
#   def GetDefinitionByName(
#       cls, name: str) -> Type[interface.ScaffolderDefinition]:
#   def GetDefinitionNames(cls) -> Iterator[str]:
#   def GetDefinitionObjects(cls) -> Iterator[interface.ScaffolderDefinition]:
#   def RegisterDefinition(
#       cls, definition_class: Type[interface.ScaffolderDefinition]):


import unittest
from l2tscaffolder.definitions import interface
from l2tscaffolder.definitions import manager
    """Sets up the test class."""
    # Need to make sure there are no registered projects, and can't iterate
    # directly over projects since changing the dict in the middle of an iter
    # causes errors.
    registered_definitions = list(
        manager.DefinitionManager.GetDefinitionObjects())
    for definition_object in registered_definitions:
      registered_class = type(definition_object)
      manager.DefinitionManager.DeregisterDefinition(registered_class)

    manager.DefinitionManager.RegisterDefinition(GoldTestProject)
    manager.DefinitionManager.RegisterDefinition(FailingTestProject)

  def testGetDefinitionByName(self):
    """Test getting definitions by name."""
    test_definition = manager.DefinitionManager.GetDefinitionByName(
        GoldTestProject.NAME)

    self.assertEqual(test_definition.NAME, GoldTestProject.NAME)

    test_definition = manager.DefinitionManager.GetDefinitionByName(
        'DoesNotExist')

    self.assertEqual(test_definition, None)

  def testRegisteringAndDeregistering(self):
    """Test registering and deregistering definitions."""
    definitions = list(manager.DefinitionManager.GetDefinitionNames())
    self.assertEqual(len(definitions), 2)


# Path: l2tscaffolder/definitions/interface.py
# class ScaffolderDefinition:
#   NAME = definitions.DEFINITION_UNDEFINED
#   def ValidatePath(self, root_path: str) -> bool:
# 
# Path: l2tscaffolder/definitions/manager.py
# class DefinitionManager:
#   def DeregisterDefinition(
#       cls, definition_class: Type[interface.ScaffolderDefinition]):
#   def GetDefinitionByName(
#       cls, name: str) -> Type[interface.ScaffolderDefinition]:
#   def GetDefinitionNames(cls) -> Iterator[str]:
#   def GetDefinitionObjects(cls) -> Iterator[interface.ScaffolderDefinition]:
#   def RegisterDefinition(
#       cls, definition_class: Type[interface.ScaffolderDefinition]):


# Path: tests/definitions/manager.py
import unittest
from l2tscaffolder.definitions import interface
from l2tscaffolder.definitions import manager

    """Sets up the test class."""
    # Need to make sure there are no registered projects, and can't iterate
    # directly over projects since changing the dict in the middle of an iter
    # causes errors.
    registered_definitions = list(
        manager.DefinitionManager.GetDefinitionObjects())
    for definition_object in registered_definitions:
      registered_class = type(definition_object)
      manager.DefinitionManager.DeregisterDefinition(registered_class)

    manager.DefinitionManager.RegisterDefinition(GoldTestProject)
    manager.DefinitionManager.RegisterDefinition(FailingTestProject)

  def testGetDefinitionByName(self):
    """Test getting definitions by name."""
    test_definition = manager.DefinitionManager.GetDefinitionByName(
        GoldTestProject.NAME)

    self.assertEqual(test_definition.NAME, GoldTestProject.NAME)

    test_definition = manager.DefinitionManager.GetDefinitionByName(
        'DoesNotExist')

    self.assertEqual(test_definition, None)

  def testRegisteringAndDeregistering(self):
    """Test registering and deregistering definitions."""
    definitions = list(manager.DefinitionManager.GetDefinitionNames())
    self.assertEqual(len(definitions), 2)


    manager.DefinitionManager.RegisterDefinition(SilverTestProject)