Skip to content

Commit

Permalink
Added regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Jun 2, 2016
1 parent c8fbe6e commit 8f63be2
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions glue/viewers/histogram/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down

0 comments on commit 8f63be2

Please sign in to comment.