|
4 | 4 | import yadg.core |
5 | 5 | from dgbowl_schemas.yadg import to_dataschema, DataSchema_4_0, DataSchema_4_1 |
6 | 6 | from pydantic import ValidationError |
7 | | -from pydantic.v1 import ValidationError as ValidationError_v1 |
8 | 7 | from .utils import datagram_from_file |
9 | 8 |
|
10 | 9 | ts0 = { |
@@ -195,29 +194,29 @@ def test_datagram_from_schema_file(inp_fn, ts, datadir): |
195 | 194 | @pytest.mark.parametrize( |
196 | 195 | "inp_dict, expr", |
197 | 196 | [ |
198 | | - (fts0, r"Discriminator 'parser' is missing in value"), |
199 | | - (fts1, r"No match for discriminator 'parser' and value 'dumm'"), |
| 197 | + (fts0, r"Unable to extract tag using discriminator 'parser'"), |
| 198 | + (fts1, r"Input tag 'dumm' found using 'parser'"), |
200 | 199 | (fts2, r"Both 'files' and 'folders'"), |
201 | 200 | (fts3, r"Neither 'files' nor 'folders'"), |
202 | | - (fts4, r"steps -> 0 -> Dummy -> key\n extra fields not permitted"), |
| 201 | + (fts4, r"Extra inputs are not permitted"), |
203 | 202 | ], |
204 | 203 | ) |
205 | 204 | def test_schema_validator_4_0(inp_dict, expr, datadir): |
206 | 205 | os.chdir(datadir) |
207 | | - with pytest.raises((ValidationError, ValidationError_v1), match=expr): |
| 206 | + with pytest.raises(ValidationError, match=expr): |
208 | 207 | assert DataSchema_4_0(**inp_dict) |
209 | 208 |
|
210 | 209 |
|
211 | 210 | @pytest.mark.parametrize( |
212 | 211 | "inp_dict, expr", |
213 | 212 | [ |
214 | | - (fts5, r"metadata -> provenance\n value is not a valid dict"), |
215 | | - (fts6, r"metadata -> version\n unexpected value"), |
216 | | - (fts7, r"steps -> 0 -> Dummy -> input\n field required"), |
217 | | - (fts8, r"Discriminator 'parser' is missing in value"), |
| 213 | + (fts5, r"Input should be a valid dictionary or instance of Provenance"), |
| 214 | + (fts6, r"Input should be '4.1', '4.1.0', '4.1.1', '4.1.2' or '4.1.3'"), |
| 215 | + (fts7, r"Field required"), |
| 216 | + (fts8, r"Unable to extract tag using discriminator 'parser'"), |
218 | 217 | ], |
219 | 218 | ) |
220 | 219 | def test_schema_validator_4_1(inp_dict, expr, datadir): |
221 | 220 | os.chdir(datadir) |
222 | | - with pytest.raises((ValidationError, ValidationError_v1), match=expr): |
| 221 | + with pytest.raises(ValidationError, match=expr): |
223 | 222 | assert DataSchema_4_1(**inp_dict) |
0 commit comments