Esempio n. 1
0
def create_fixture2():
    '''
    Creates fixture file for testing the flight away from newighbouring boids.
    '''
    # *******************************************************
    # Write fixture file for the BoidsMaster.fly_away_from_neighbours()
    fixt_boids = BoidsMaster()
    before_positions = deepcopy(fixt_boids.positions.tolist())
    before_velocities = deepcopy(fixt_boids.velocities.tolist())
    fixt_boids.fly_away_from_neighbours()
    fixt_boids.update_positions()

    after_positions = fixt_boids.positions.tolist()
    after_velocities = fixt_boids.velocities.tolist()

    beforeM2 = (before_positions, before_velocities)
    afterM2 = (after_positions, after_velocities)

    fixture = {"before": beforeM2, "after": afterM2}
    fixture_file = open("tests/fixtures/fixture_fly_away_neighbours.yml", 'w')
    fixture_file.write(yaml.dump(fixture))
    fixture_file.close()