Skip to content

Commit

Permalink
Add individual descriptors test.
Browse files Browse the repository at this point in the history
  • Loading branch information
PytLab committed Dec 12, 2017
1 parent 01d399c commit c7c0e77
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/individual_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ def test_binary_encoding(self):
# Test decode.
self.assertListEqual(indv.decode(), [0.396484375, 0.658203125])

def test_descriptors(self):
''' Make sure descriptors can check the parameters correctly.
'''
self.assertRaises(TypeError, BinaryIndividual, ranges=0.1, eps=0.001, verbosity=0)
self.assertRaises(TypeError, BinaryIndividual, ranges=[(0, 1)], eps='asdf', verbosity=0)
self.assertRaises(ValueError, BinaryIndividual, ranges=[(0, 1)], eps=10.0, verbosity=0)
self.assertRaises(ValueError, BinaryIndividual, ranges=[(0, 1)], eps=[1, 2], verbosity=0)

def test_init(self):
''' Make sure the individual can be initialized correctly.
'''
Expand Down

0 comments on commit c7c0e77

Please sign in to comment.