# 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
  l1 = list(s1.And(s2)(tree))
  assert(len(l1) == 2)
  return

def TestOr():
  """ Test Or selector combinator."""
  s1 = S.S(node_type = N.CallFunction)
  s2 = S.S(node_type = N.DefineFunction)

  l1 = list(s1.Or(s2)(tree))
  assert(len(l1) == 2)
  return


def TestHasParent():
  """ Test HasParent selector combinator."""
  s1 = S.S(node_type = N.ReferVariable)
  s2 = S.S(node_type = N.CallFunction)

  l1 = list(s1.HasParent(s2)(tree))
  assert(len(l1) == 1)
  assert(l1[0].GetName() == 'ReferVariable')
  return


def TestHasAncestor():
  """ Test HasAncestor selector combinator."""
  s1 = S.S(node_type = N.CallFunction)
  s2 = S.S(node_type = N.Return)


# 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

  l1 = list(s1.And(s2)(tree))
  assert(len(l1) == 2)
  return

def TestOr():
  """ Test Or selector combinator."""
  s1 = S.S(node_type = N.CallFunction)
  s2 = S.S(node_type = N.DefineFunction)

  l1 = list(s1.Or(s2)(tree))
  assert(len(l1) == 2)
  return


def TestHasParent():
  """ Test HasParent selector combinator."""
  s1 = S.S(node_type = N.ReferVariable)
  s2 = S.S(node_type = N.CallFunction)

  l1 = list(s1.HasParent(s2)(tree))
  assert(len(l1) == 1)
  assert(l1[0].GetName() == 'ReferVariable')
  return


def TestHasAncestor():
  """ Test HasAncestor selector combinator."""
  s1 = S.S(node_type = N.CallFunction)
  s2 = S.S(node_type = N.Return)


  l1 = list(s1.HasAncestor(s2)(tree))