|
1 | 1 | from astropy.cosmology import FlatLambdaCDM, default_cosmology
|
2 | 2 | from astropy.cosmology.core import Cosmology
|
3 | 3 | from astropy.io import fits
|
4 |
| -from astropy.table import Table |
| 4 | +from astropy.table import Table, vstack |
5 | 5 | from astropy.table.column import Column
|
6 | 6 | from astropy.units import Quantity
|
7 | 7 | from astropy.utils.data import get_pkg_data_filename
|
@@ -237,6 +237,28 @@ def value_in_cm(q):
|
237 | 237 | np.testing.assert_array_less(pipeline['test_table.lengths_in_cm'], 100)
|
238 | 238 |
|
239 | 239 |
|
| 240 | +def test_depends(): |
| 241 | + |
| 242 | + # Regression test for GitHub Issue #464 |
| 243 | + # Previously the .depends keyword was also being passed to functions as a |
| 244 | + # keyword argument. This was because Pipeline was executing Item.infer to |
| 245 | + # handle additional function arguments from context before handling |
| 246 | + # additional dependencies specified using the .depends keyword. The |
| 247 | + # .depends keyword is now handled first. |
| 248 | + |
| 249 | + config = {'tables': { |
| 250 | + 'table_1': { |
| 251 | + 'column1': Call(np.random.uniform, [0, 1, 10])}, |
| 252 | + 'table_2': { |
| 253 | + '.init': Call(vstack, [], { |
| 254 | + 'tables': [Ref('table_1')], |
| 255 | + '.depends': ['table_1.complete']})}}} |
| 256 | + |
| 257 | + pipeline = Pipeline(config) |
| 258 | + pipeline.execute() |
| 259 | + assert np.all(pipeline['table_1'] == pipeline['table_2']) |
| 260 | + |
| 261 | + |
240 | 262 | def teardown_module(module):
|
241 | 263 |
|
242 | 264 | # Remove fits file generated in test_pipeline
|
|
0 commit comments