Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong error yielded #50

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pvframework/mapped_validators/path_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def provide(self, data_set: DataSetT) -> Generator[Parameters[DataSetT] | Except
if param_name in self.validator.required_param_names:
query_error = AttributeError(f"{attr_path} not provided")
query_error.__cause__ = error
yield error
yield query_error
skip = True
break
value = self.validator.signature.parameters[param_name].default
Expand Down
2 changes: 1 addition & 1 deletion src/pvframework/mapped_validators/query_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def provide(self, data_set: DataSetT) -> Generator[Parameters[DataSetT] | Except
if isinstance(param_value, Exception):
assert param_name in self.validator.optional_param_names, (
"If the parameter is required but not supplied you should yield an exception "
"in `paran_sets` directly. The dictionary of parameters should only contain exceptions if"
"in `param_sets` directly. The dictionary of parameters should only contain exceptions if"
"they are negligible aka the parameter is optional."
)
parameter_dict[param_name] = Parameter(
Expand Down
2 changes: 1 addition & 1 deletion unittests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ async def test_unprovided_but_required(self):
validation_summary = await validation_manager.validate(dataset_instance)

assert validation_summary.num_errors_total == 1
assert "'z.z' does not exist" in str(validation_summary.all_errors[0])
assert "z.z not provided" in str(validation_summary.all_errors[0])

async def test_multiple_validator_registration(self):
global finishing_order
Expand Down