-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG: Fix undefined variable in DataLabel when arrow_visible is False.
Closes gh-281.
- Loading branch information
1 parent
2fc5251
commit 6227202
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import unittest | ||
from chaco.api import create_scatter_plot, PlotGraphicsContext, DataLabel | ||
|
||
|
||
class DataLabelTestCase(unittest.TestCase): | ||
|
||
def test_data_label_arrow_not_visible(self): | ||
# Regression test for https://github.com/enthought/chaco/issues/281 | ||
# Before the problem was fixed, this test (specifically, using | ||
# arrow_visible=False in the DataLabel constructor) would raise an | ||
# exception because of an undefined reference. | ||
size = (50, 50) | ||
plot = create_scatter_plot(data=[range(10), range(10)]) | ||
label = DataLabel(component=plot, | ||
data_point=(4, 4), | ||
marker_color="red", | ||
marker_size=3, | ||
label_position=(20, 50), | ||
label_style='bubble', | ||
label_text="Something interesting", | ||
label_format="at x=%(x).2f, y=%(y).2f", | ||
arrow_visible=False) | ||
plot.overlays.append(label) | ||
plot.outer_bounds = list(size) | ||
gc = PlotGraphicsContext(size) | ||
gc.render_component(plot) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |