From 8f63be26ac06d2a4a74dd3eb8a3ce3a483dbe9f0 Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Thu, 2 Jun 2016 17:10:21 +0100 Subject: [PATCH] Added regression test --- glue/viewers/histogram/tests/test_client.py | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/glue/viewers/histogram/tests/test_client.py b/glue/viewers/histogram/tests/test_client.py index 54b8daac9..d2b23126e 100644 --- a/glue/viewers/histogram/tests/test_client.py +++ b/glue/viewers/histogram/tests/test_client.py @@ -323,6 +323,32 @@ def test_component_replaced(self): self.data.update_id(self.client.component, test) assert self.client.component is test + def test_update_when_limits_unchanged(self): + + # Regression test for glue-viz/glue#1010 - this bug caused histograms + # to not be recomputed if the attribute changed but the limits and + # number of bins did not. + + self.client.add_layer(self.data) + + self.client.set_component(self.data.id['y']) + self.client.xlimits = -20, 20 + self.client.nbins = 12 + + y1 = self.client._artists[0]._y + + self.client.set_component(self.data.id['x']) + self.client.xlimits = -20, 20 + self.client.nbins = 12 + + y2 = self.client._artists[0]._y + assert not np.allclose(y1, y2) + + self.client.set_component(self.data.id['y']) + + y3 = self.client._artists[0]._y + np.testing.assert_allclose(y1, y3) + class TestCategoricalHistogram(TestHistogramClient):