def test_unit_cell_updates_distributions(self): generator = BraggPeakEventGenerator(['5.431 5.431 5.431', 'F d -3 m', 'Si 0 0 0 1.0 0.01'], 3.0, 4.0, MockTOFFactorCalculator([2500.])) with patch.object(generator, '_update_distributions_and_weights') as mock_method: generator.unit_cell = '4 4 4' self.assertEquals(generator.unit_cell, '4 4 4') self.assertEqual(mock_method.call_count, 1, '_update_distributions_and_weights has been called the wrong number of times when setting unit_cell: {}'.format( mock_method.call_count))