def test_init(self, set_data):
     """ Ensures it attempts to set the data of the gene. """
     some_data = Mock()
     gn = Gene(some_data)
     set_data.assert_called_with(some_data)
 def test_get_info(self):
     """ Ensure the retrieval of information throws an error. """
     gn = Gene(None)
     self.assertRaises(NotImplementedError, gn.get_information)
 def test_get_data(self):
     """ Ensures the retrieval of data works correctly. """
     some_data = Mock()
     gn = Gene(some_data)    # We know set data is called here.
     assert gn._data is some_data
     assert gn.get_data() is some_data
 def test_set_data(self):
     """ Ensure the data is set. """
     some_data = Mock()
     gn = Gene(some_data)    # We know set data is called here.
     assert gn._data is some_data
示例#5
0
 def __init__(self, value):
     """ Instantiates this binary gene with the given value. """
     Gene.__init__(self, value)
 def __init__(self, contents):
     """ Initialises the components of this sub-matrix. """
     Gene.__init__(
         self, contents)  # Contents is a string grammatical representation.