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_valid_content_empty_tag(self): node = create_node('') validator = NodeStructureChecker(PRELUDE_TAGS, 'ghi', EPILOGUE_TAGS) self.assertTrue(validator.is_valid(node))
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_invalid_content(self): node = create_node('aabbccgHixxyyzz') validator = NodeStructureChecker(PRELUDE_TAGS, 'ghi', EPILOGUE_TAGS) self.assertFalse(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 test_valid_content_without_prelude(self): node = create_node("ghixxyyzz") validator = NodeStructureChecker(PRELUDE_TAGS, "ghi", EPILOGUE_TAGS) self.assertTrue(validator.is_valid(node))