Closed schrum2 closed 2 years ago
There are now 4 shapes that were created to test type_count
fitness function. All 4 pass (the code is a little bit ugly however)
.
Made unit tests for type_target
using the same shapes (but around 100 spaces away in the z coordinate). I still need to display a better message when the tests are run while the server is not connected.
Both of the tests are now in try/except blocks in the case that the server is not connected.
New [more clear] error message produced when running the tests without successfully being connected to the server:
.
It turns out pytest is pretty easy to use. After installing it with from the requirements file, look at
test_util.py
and see how it works. Just runpytest
in the project directory to execute the tests.You will need to make a new file
test_fitness_functions.py
that contains functionstest_type_count
andtest_type_target
. Each will need to initialize a Minecraft server client connection (as done in the constructors for the two breeder classes), and use that to artificially create some shapes, before then using the fitness functions to retrieve the calculated scores.Running these tests will only work if a Minecraft server is running on the local machine. That could be an issue eventually, but for now don't worry about it. Do keep in mind that this will put shapes into your Minecraft world. You make want to make sure that you empty the space before and after. You might also want to place the shapes somewhere else in the world than around (0,5,0), which is where most of our shapes evolve.