def get_test_index(test):
    """Get the index of the test under its parent or None if it's the top.

    The returned index starts count at 1.

    Returns:
        number. test's index under its parent.
    """
    if test.parent is None:
        return None

    return test.parent._tests.index(test) + 1