()
| 53 | |
| 54 | |
| 55 | def test_declaration(): |
| 56 | |
| 57 | table = pa.table({'a': [1, 2, 3], 'b': [4, 5, 6]}) |
| 58 | table_opts = TableSourceNodeOptions(table) |
| 59 | filter_opts = FilterNodeOptions(field('a') > 1) |
| 60 | |
| 61 | # using sequence |
| 62 | decl = Declaration.from_sequence([ |
| 63 | Declaration("table_source", options=table_opts), |
| 64 | Declaration("filter", options=filter_opts) |
| 65 | ]) |
| 66 | result = decl.to_table() |
| 67 | assert result.equals(table.slice(1, 2)) |
| 68 | |
| 69 | # using explicit inputs |
| 70 | table_source = Declaration("table_source", options=table_opts) |
| 71 | filtered = Declaration("filter", options=filter_opts, inputs=[table_source]) |
| 72 | result = filtered.to_table() |
| 73 | assert result.equals(table.slice(1, 2)) |
| 74 | |
| 75 | |
| 76 | def test_declaration_repr(table_source): |
nothing calls this directly
no test coverage detected