Commit 1728938e authored by Yori Fournier's avatar Yori Fournier
Browse files

A misunderstanding between aliases and keywords between the "old" and "new"

fashion. Aliases are not meant to be used as keywords, which may be misleading
when looking at FigTestWithAliases in figures_tests.py

I modified FigTestAxesAliases: now the alias y_range becomes y_range_alias
so that the keyword y_range is not overwritten by the alias and does not
gain priority.
parent c5c6ad6b
Pipeline #608 failed with stage
in 11 minutes and 55 seconds
......@@ -61,5 +61,5 @@ class FigTestAxesAliases(MplFig):
def declare_aliases(self):
self.aliases.update({'x_range': ('p1_x_range', 'p2_x_range'),
'y_range': ('p1_y_range', 'p2_y_range')})
self.aliases.update({'x_range_alias': ('p1_x_range', 'p2_x_range'),
'y_range_alias': ('p1_y_range', 'p2_y_range')})
......@@ -118,8 +118,8 @@ class TestMyFig(unittest.TestCase):
def test_constructore_with_aliased_keywords(self):
'''Verify that keywords meant for axes are well passed, even when aliased.
Test that a non-alised keyword goes to all axes (x_range) and that aliased
keywords are well passed (y_range_p1)
Test that a non-aliased keyword goes to all axes (x_range) and that tagged
keywords are well passed (p1_y_range)
'''
fig = FigTestAxesAliases((self.data_1, self.data_2), x_range=[-2., 2.], p1_y_range=[-3., 3.])
# test axes attributes
......@@ -187,11 +187,10 @@ class TestMyFig(unittest.TestCase):
# test if aliases have higher priority than keywords
fig.update(y_range=[31, 10], alias_for_yrange=[10, 31])
self.assertEqual(ax.keywords["y_range"], [10, 31])
# test if explicit keywords have higher priority than keywords
fig.update(y_range=[12, 13], p1_y_range=[15, 20])
self.assertEqual(ax.keywords["y_range"], [15, 20])
def test_set_rawdata(self):
'''Verify the well function of set_rawdata
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment