def test_TransferralGoal_update_goal_template():
    target_1 = {
        'id': str(uuid.uuid4()),
        'info': ['blue', 'rubber', 'ball'],
        'goalString': 'blue rubber ball',
        'pickupable': True,
        'type': 'sphere'
    }
    target_2 = {
        'id': str(uuid.uuid4()),
        'info': ['grey', 'fabric', 'sofa'],
        'goalString': 'grey fabric sofa',
        'attributes': [],
        'type': 'sofa',
        'stackTarget': True
    }

    goal = TransferralGoal('')
    config = goal.update_goal_template({}, [target_1, target_2])

    relationship = config['metadata']['relationship']
    relationship_type = relationship[1]
    assert relationship_type in [
        item.value for item in TransferralGoal.RelationshipType
    ]

    assert config['description'] == 'Find and pick up the blue rubber ' + \
        'ball and move it ' + relationship_type + ' the grey fabric sofa.'
    assert config['metadata']['target_1']['id'] == target_1['id']
    assert config['metadata']['target_1']['info'] == ['blue', 'rubber', 'ball']
    assert config['metadata']['target_2']['id'] == target_2['id']
    assert config['metadata']['target_2']['info'] == ['grey', 'fabric', 'sofa']
def test_TransferralGoal_validate_target_location_1_false():
    target_1 = {'shows': [{'position': {'x': 1, 'y': 0, 'z': 1}}]}

    goal = TransferralGoal('')
    assert not goal.validate_target_location(
        1, {'position': {
            'x': 2.9,
            'y': 0,
            'z': 1
        }}, [target_1], geometry.ORIGIN_LOCATION)
    assert not goal.validate_target_location(
        1, {'position': {
            'x': 1,
            'y': 0,
            'z': 2.9
        }}, [target_1], geometry.ORIGIN_LOCATION)
    assert not goal.validate_target_location(
        1, {'position': {
            'x': -0.9,
            'y': 0,
            'z': 1
        }}, [target_1], geometry.ORIGIN_LOCATION)
    assert not goal.validate_target_location(
        1, {'position': {
            'x': 1,
            'y': 0,
            'z': -0.9
        }}, [target_1], geometry.ORIGIN_LOCATION)
def test_TransferralGoal_get_target_count():
    goal = TransferralGoal('')
    assert goal.get_target_count() == 2
def test_TransferralGoal_choose_target_definition_1():
    goal = TransferralGoal('')
    definition = goal.choose_target_definition(1)
    assert definition
    assert 'stackTarget' in definition['attributes']
def test_TransferralGoal_choose_target_definition_0():
    goal = TransferralGoal('')
    definition = goal.choose_target_definition(0)
    assert definition
    assert 'pickupable' in definition['attributes']
def test_TransferralGoal_validate_target_location_0():
    goal = TransferralGoal('')
    assert goal.validate_target_location(0, {}, [], geometry.ORIGIN_LOCATION)