# Path: redhawk/test/sample_last.py



import redhawk.common._selector as S
import redhawk.common.node as N
import nose
from .sample_last import tree
  s2 = S.Selector(node_type = N.CallFunction)

  l1 = list(S.RunSelector(
              S.HasAncestor(s2, s1),
              tree))
  assert(len(l1) == 1)
  assert(l1[0].GetName() == 'CallFunction')
  return


def TestHasChild():
  """ Test HasChild selector combinator."""
  s1 = S.Selector(node_type = N.CallFunction)
  s2 = S.Selector(node_type = N.ReferVariable)

  l1 = list(S.RunSelector(
              S.HasChild(s1, s2),
              tree))
  assert(len(l1) == 1)
  assert(l1[0].GetName() == 'CallFunction')
  return


def TestHasDescendant():
  """ Test HasDescendant selector combinator."""
  s1 = S.Selector(node_type = N.Return)
  s2 = S.Selector(node_type = N.CallFunction)

  l1 = list(S.RunSelector(
              S.HasDescendant(s1, s2),

# Path: redhawk/test/sample_last.py



# Path: redhawk/test/test_common__selector.py
import redhawk.common._selector as S
import redhawk.common.node as N
import nose
from .sample_last import tree

  s2 = S.Selector(node_type = N.CallFunction)

  l1 = list(S.RunSelector(
              S.HasAncestor(s2, s1),
              tree))
  assert(len(l1) == 1)
  assert(l1[0].GetName() == 'CallFunction')
  return


def TestHasChild():
  """ Test HasChild selector combinator."""
  s1 = S.Selector(node_type = N.CallFunction)
  s2 = S.Selector(node_type = N.ReferVariable)

  l1 = list(S.RunSelector(
              S.HasChild(s1, s2),
              tree))
  assert(len(l1) == 1)
  assert(l1[0].GetName() == 'CallFunction')
  return


def TestHasDescendant():
  """ Test HasDescendant selector combinator."""
  s1 = S.Selector(node_type = N.Return)
  s2 = S.Selector(node_type = N.CallFunction)

  l1 = list(S.RunSelector(
              S.HasDescendant(s1, s2),

              tree))