|
5 | 5 | """ |
6 | 6 |
|
7 | 7 | import json |
| 8 | +import re |
8 | 9 |
|
9 | 10 | import pytest |
10 | 11 |
|
@@ -46,8 +47,14 @@ def config(): |
46 | 47 | ], |
47 | 48 | ) |
48 | 49 | def test_is_entry_table(table_name, expected): |
49 | | - """Only Entry tables get the slot; parts inherit their master's.""" |
50 | | - assert provenance.is_entry_table(table_name) is expected |
| 50 | + """Only Entry tables get the slot; parts inherit their master's. |
| 51 | +
|
| 52 | + Exercises the predicate `declare` and `deploy` use: a match against the |
| 53 | + Manual tier itself, rather than a list of prefixes to exclude. |
| 54 | + """ |
| 55 | + from datajoint.user_tables import Manual |
| 56 | + |
| 57 | + assert bool(re.fullmatch(Manual.tier_regexp, table_name)) is expected |
51 | 58 |
|
52 | 59 |
|
53 | 60 | def test_payload_is_none_without_anything_to_say(config): |
@@ -138,18 +145,19 @@ def test_entry_test_follows_the_tier_definition_not_a_prefix_list(): |
138 | 145 | `Manual.tier_regexp` inverts that: a name is an Entry table only if the |
139 | 146 | library says it is. |
140 | 147 | """ |
141 | | - import re |
142 | | - |
143 | 148 | from datajoint.user_tables import Computed, Imported, Lookup, Manual, Part |
144 | 149 |
|
145 | | - assert provenance.is_entry_table("subject") |
| 150 | + def grants_prov(name): |
| 151 | + return re.fullmatch(Manual.tier_regexp, name) is not None |
| 152 | + |
| 153 | + assert grants_prov("subject") |
146 | 154 | for tier in (Lookup, Imported, Computed, Part): |
147 | 155 | sample = {Lookup: "#param", Imported: "_ingest", Computed: "__analysis", Part: "subject__detail"}[tier] |
148 | 156 | assert re.fullmatch(tier.tier_regexp, sample), f"{sample} is not a {tier.__name__}" |
149 | | - assert not provenance.is_entry_table(sample) |
| 157 | + assert not grants_prov(sample) |
150 | 158 | # The job prefix belongs to no user tier at all, which is how it slipped through. |
151 | 159 | assert not any(re.fullmatch(t.tier_regexp, "~~analysis") for t in (Manual, Lookup, Imported, Computed, Part)) |
152 | | - assert not provenance.is_entry_table("~~analysis") |
| 160 | + assert not grants_prov("~~analysis") |
153 | 161 |
|
154 | 162 |
|
155 | 163 | def test_serialize_survives_a_deployment_supplied_source(config): |
|
0 commit comments