import traceback


def test_get_family_relation(sft):
  """Tests that SequencedFamilyTree.get_family_relation(A,B):
  - correctly identifies relations
  - correctly throws a NodeNotFound error"""


  print("sft.nodes")
  print(sft.nodes)

  assert(sft.get_family_relation("you", "grandfather") == "grandparent")
  assert(sft.get_family_relation("you", "father") == "parent")
  assert(sft.get_family_relation("you", "mother") == "parent")
  assert(sft.get_family_relation("you", "uncle1") == "uncle/aunt")
  assert(sft.get_family_relation("you", "aunt-in-law1") == "uncle-/aunt-in-law")
  assert(sft.get_family_relation("you", "cousin1") == "cousin")
  assert(sft.get_family_relation("you", "brother1") == "sibling")
  assert(sft.get_family_relation("you", "sister1") == "sibling")
  assert(sft.get_family_relation("you", "child1") == "child")
  assert(sft.get_family_relation("you", "sister-in-law1") == "sibling-in-law")
  assert(sft.get_family_relation("you", "niece1") == "nephew/niece")
  assert(sft.get_family_relation("you", "son-in-law1") == "child-in-law")
  assert(sft.get_family_relation("you", "grandchild1") == "grandchild")

  #assert (sft.get_family_relation("you", "granduncle") == "grand uncle/aunt")
  assert (sft.get_family_relation("you", "cousinOnceRemoved") == "cousin once-removed")
  assert (sft.get_family_relation("you", "greatgrandfather") == "great grandparent")
  assert (sft.get_family_relation("you", "secondcousin") == "second cousin")
  assert (sft.get_family_relation("you", "greatgrandniece") == "great grand nephew/niece")


  print('all assertion passed sucessfully,')
  try:
      sft.get_family_relation('babar','mother')
  except Exception as e:
      print('sucessfully threw the NetworkxNoPath Exception:', traceback.format_exc())
      return -1