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
 def test_reorg_with_zero_nodes(self):
     node = create_node('')
     self.nodeorganizer.reorder(node)
     self.assertEqual(0, len(node))
 def test_invalid_content(self):
     node = create_node('aabbccgHixxyyzz')
     validator = NodeStructureChecker(PRELUDE_TAGS, 'ghi', EPILOGUE_TAGS)
     self.assertFalse(validator.is_valid(node))
Exemple #5
0
 def test_invalid_structure_a_in_midrange_without_prelude(self):
     nodes = create_node('gahi' 'xxxyyzz')
     self.assertFalse(has_valid_structure(nodes))
Exemple #6
0
 def test_invalid_structure_x_in_midrange_without_epilouge(self):
     nodes = create_node('aabccc' 'gxhi')
     self.assertFalse(has_valid_structure(nodes))
 def test_no_epilogue_tags(self):
     with self.assertRaises(ValueError):
         EpilogueTagBlock(create_node('abc'), '')
Exemple #8
0
 def test_invalid_structure_b_after_c(self):
     nodes = create_node('aabbcb' 'ghi' 'xxxyyzz')
     self.assertFalse(has_valid_structure(nodes))
Exemple #9
0
 def test_invalid_structure_x_in_midrange_without_epilouge(self):
     nodes = create_node('aabccc' 'gxhi')
     self.assertFalse(has_valid_structure(nodes))
 def test_invalid_content(self):
     node = create_node('aabbccgHixxyyzz')
     validator = NodeStructureChecker(PRELUDE_TAGS, 'ghi', EPILOGUE_TAGS)
     self.assertFalse(validator.is_valid(node))
Exemple #11
0
 def test_invalid_structure_a_in_midrange_without_prelude(self):
     nodes = create_node('gahi' 'xxxyyzz')
     self.assertFalse(has_valid_structure(nodes))
Exemple #12
0
 def test_invalid_structure_x_in_midrange(self):
     nodes = create_node('aabccc' 'gxhi' 'xxxyyzz')
     self.assertFalse(has_valid_structure(nodes))
Exemple #13
0
 def test_invalid_structure_x_after_y(self):
     nodes = create_node('aabbcc' 'ghi' 'xxyxyzz')
     self.assertFalse(has_valid_structure(nodes))
Exemple #14
0
 def test_invalid_structure_b_after_c(self):
     nodes = create_node('aabbcb' 'ghi' 'xxxyyzz')
     self.assertFalse(has_valid_structure(nodes))
Exemple #15
0
 def test_valid_structure_unsorted_midrange(self):
     nodes = create_node('aabbcc' 'ihg' 'xxxyyzz')
     self.assertTrue(has_valid_structure(nodes))
 def test_valid_content_empty_tag(self):
     node = create_node('')
     validator = NodeStructureChecker(PRELUDE_TAGS, 'ghi', EPILOGUE_TAGS)
     self.assertTrue(validator.is_valid(node))
Exemple #17
0
 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_unique_order_tags(self):
     with self.assertRaises(ValueError):
         PreludeTagBlock(create_node("abc"), "abcc")
Exemple #19
0
 def test_reorg_with_zero_nodes(self):
     node = create_node('')
     self.nodeorganizer.reorder(node)
     self.assertEqual(0, len(node))
 def test_valid_content_empty_tag(self):
     node = create_node('')
     validator = NodeStructureChecker(PRELUDE_TAGS, 'ghi', EPILOGUE_TAGS)
     self.assertTrue(validator.is_valid(node))
Exemple #21
0
 def test_reorg_with_one_node(self):
     node = create_node('g')
     self.nodeorganizer.reorder(node)
     self.assertEqual('g', node[0].tag)
Exemple #22
0
 def test_valid_structure_unsorted_midrange(self):
     nodes = create_node('aabbcc' 'ihg' 'xxxyyzz')
     self.assertTrue(has_valid_structure(nodes))
Exemple #23
0
def getPTB(nodes, preludetags='abc'):
    return PreludeTagBlock(create_node(nodes), preludetags)
Exemple #24
0
 def test_invalid_structure_x_after_y(self):
     nodes = create_node('aabbcc' 'ghi' 'xxyxyzz')
     self.assertFalse(has_valid_structure(nodes))
Exemple #25
0
 def count(self, nodes):
     prelude = PreludeTagBlock(create_node(nodes), self.tags)
     return len(prelude)
Exemple #26
0
 def test_invalid_structure_x_in_midrange(self):
     nodes = create_node('aabccc' 'gxhi' 'xxxyyzz')
     self.assertFalse(has_valid_structure(nodes))
Exemple #27
0
 def test_no_prelude_tags(self):
     with self.assertRaises(ValueError):
         PreludeTagBlock(create_node('abc'), '')
Exemple #28
0
 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))
Exemple #29
0
 def test_unique_order_tags(self):
     with self.assertRaises(ValueError):
         PreludeTagBlock(create_node('abc'), 'abcc')
Exemple #30
0
 def test_reorg_with_one_node(self):
     node = create_node('g')
     self.nodeorganizer.reorder(node)
     self.assertEqual('g', node[0].tag)
def getETB(nodes, tags='xyz'):
    return EpilogueTagBlock(create_node(nodes), tags)
 def test_valid_content_without_epilogue(self):
     node = create_node('aabbccghi')
     validator = NodeStructureChecker(PRELUDE_TAGS, 'ghi', EPILOGUE_TAGS)
     self.assertTrue(validator.is_valid(node))
 def test_unique_order_tags(self):
     with self.assertRaises(ValueError):
         EpilogueTagBlock(create_node('abc'), 'abcc')
Exemple #34
0
def getPTB(nodes, preludetags='abc'):
    return PreludeTagBlock(create_node(nodes), preludetags)
 def test_tag_error(self):
     tb = EpilogueTagBlock(create_node('abc'), 'xyz')
     with self.assertRaises(ValueError):
         tb.insert_position_after('d')
 def test_no_epilogue_tags(self):
     with self.assertRaises(ValueError):
         EpilogueTagBlock(create_node('abc'), '')
Exemple #37
0
 def count(self, nodes):
     prelude = PreludeTagBlock(create_node(nodes), self.tags)
     return len(prelude)
 def test_tag_error(self):
     tb = EpilogueTagBlock(create_node('abc'), 'xyz')
     with self.assertRaises(ValueError):
         tb.insert_position_after('d')
Exemple #39
0
 def test_no_prelude_tags(self):
     with self.assertRaises(ValueError):
         PreludeTagBlock(create_node('abc'), '')
 def test_valid_content_without_epilogue(self):
     node = create_node('aabbccghi')
     validator = NodeStructureChecker(PRELUDE_TAGS, 'ghi', EPILOGUE_TAGS)
     self.assertTrue(validator.is_valid(node))
 def test_valid_content_without_prelude(self):
     node = create_node("ghixxyyzz")
     validator = NodeStructureChecker(PRELUDE_TAGS, "ghi", EPILOGUE_TAGS)
     self.assertTrue(validator.is_valid(node))
 def test_valid_content_one_tag(self):
     node = create_node("g")
     validator = NodeStructureChecker(PRELUDE_TAGS, "ghi", EPILOGUE_TAGS)
     self.assertTrue(validator.is_valid(node))
def getETB(nodes, tags='xyz'):
    return EpilogueTagBlock(create_node(nodes), tags)