def test_d_max_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.d_max = 4.0
            self.assertEquals(generator.d_max, 4.0)

        self.assertEqual(mock_method.call_count, 1,
                         '_update_distributions_and_weights has been called the wrong number of times when setting d_max: {}'.format(
                             mock_method.call_count))