def test_reorder(self):
        node = create_node(get_n_random_tags(50, list(PRELUDE_TAGS+'ghi'+EPILOGUE_TAGS)))
        no = PreludeEpilogueOrganizer(PRELUDE_TAGS, EPILOGUE_TAGS)
        no.reorder(node)
        validator = NodeStructureChecker(PRELUDE_TAGS, 'ghi', EPILOGUE_TAGS)

        self.assertEqual(has_valid_structure(node), validator.is_valid(node))
    def test_reorder(self):
        node = create_node(get_n_random_tags(50, list(PRELUDE_TAGS+'ghi'+EPILOGUE_TAGS)))
        no = PreludeEpilogueOrganizer(PRELUDE_TAGS, EPILOGUE_TAGS)
        no.reorder(node)
        validator = NodeStructureChecker(PRELUDE_TAGS, 'ghi', EPILOGUE_TAGS)

        self.assertEqual(has_valid_structure(node), validator.is_valid(node))
Exemple #3
0
class TestPreludeEpilogueOrganizer(unittest.TestCase):
    def setUp(self):
        self.nodeorganizer = PreludeEpilogueOrganizer(PRELUDE_TAGS, EPILOGUE_TAGS)

    def test_reorg(self):
        tags = get_n_random_tags(100, ALLTAGS)
        tree = create_node(tags)
        self.nodeorganizer.reorder(tree)
        self.assertTrue(has_valid_structure(tree))

    def test_reorg_with_zero_nodes(self):
        node = create_node('')
        self.nodeorganizer.reorder(node)
        self.assertEqual(0, len(node))

    def test_reorg_with_one_node(self):
        node = create_node('g')
        self.nodeorganizer.reorder(node)
        self.assertEqual('g', node[0].tag)
Exemple #4
0
class TestPreludeEpilogueOrganizer(unittest.TestCase):
    def setUp(self):
        self.nodeorganizer = PreludeEpilogueOrganizer(PRELUDE_TAGS,
                                                      EPILOGUE_TAGS)

    def test_reorg(self):
        tags = get_n_random_tags(100, ALLTAGS)
        tree = create_node(tags)
        self.nodeorganizer.reorder(tree)
        self.assertTrue(has_valid_structure(tree))

    def test_reorg_with_zero_nodes(self):
        node = create_node('')
        self.nodeorganizer.reorder(node)
        self.assertEqual(0, len(node))

    def test_reorg_with_one_node(self):
        node = create_node('g')
        self.nodeorganizer.reorder(node)
        self.assertEqual('g', node[0].tag)
Exemple #5
0
 def setUp(self):
     self.nodeorganizer = PreludeEpilogueOrganizer(PRELUDE_TAGS, EPILOGUE_TAGS)
Exemple #6
0
 def setUp(self):
     self.nodeorganizer = PreludeEpilogueOrganizer(PRELUDE_TAGS,
                                                   EPILOGUE_TAGS)