def test_deletion_interspersed(self): a = [('__BEGIN__', EPS_LABEL), ('f', 'f'), (EPS_LABEL, EPS_LABEL), ('o', EPS_LABEL), (EPS_LABEL, EPS_LABEL), ('o', 'o')] actual = list(conv_norm.revert_conversion(a, EPS_LABEL)) expected = [('foo', 'fo')] self.assertEqual(actual, expected)
def test_insertion_at_beginning_with_keep(self): a = [('__BEGIN__', 'f'), ('o', KEEP_LABEL), ('o', KEEP_LABEL)] actual = list(conv_norm.revert_conversion(a, EPS_LABEL)) expected = [('oo', 'foo')] self.assertEqual(actual, expected)
def test_mixed_insertion_and_deletion_with_keep(self): a = [('__BEGIN__', EPS_LABEL), ('f', 'o'), ('o', 'x'), ('y', 'n')] actual = list(conv_norm.revert_conversion(a, EPS_LABEL)) expected = [('foy', 'oxn')] self.assertEqual(actual, expected)
def test_identity_with_keep(self): a = [('__BEGIN__', EPS_LABEL), ('f', KEEP_LABEL), ('o', KEEP_LABEL), ('o', KEEP_LABEL)] actual = list(conv_norm.revert_conversion(a, EPS_LABEL)) expected = [('foo', 'foo')] self.assertEqual(actual, expected)