Ejemplo n.º 1
0
  def testSubtype(self):
    pytree_utils.AppendNodeAnnotation(self._leaf,
                                      pytree_utils.Annotation.SUBTYPE, _FOO)

    self.assertSetEqual(
        pytree_utils.GetNodeAnnotation(self._leaf,
                                       pytree_utils.Annotation.SUBTYPE), {_FOO})

    pytree_utils.RemoveSubtypeAnnotation(self._leaf, _FOO)

    self.assertSetEqual(
        pytree_utils.GetNodeAnnotation(self._leaf,
                                       pytree_utils.Annotation.SUBTYPE), set())
Ejemplo n.º 2
0
 def _AppendTokenSubtype(self, node, subtype, force=True):
     """Append the token's subtype only if it's not already set."""
     pytree_utils.AppendNodeAnnotation(node,
                                       pytree_utils.Annotation.SUBTYPE,
                                       subtype)