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

style: Add field information when raising validation errors. #956

Merged
merged 4 commits into from
Feb 29, 2024

Conversation

Z33DD
Copy link
Contributor

@Z33DD Z33DD commented Feb 28, 2024

No description provided.

@Z33DD Z33DD requested review from a team as code owners February 28, 2024 22:14
Copy link

google-cla bot commented Feb 28, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@product-auto-label product-auto-label bot added the api: datastore Issues related to the googleapis/python-ndb API. label Feb 28, 2024
@sorced-jim sorced-jim added kokoro:run Add this label to force Kokoro to re-run the tests. owlbot:run Add this label to trigger the Owlbot post processor. labels Feb 28, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 28, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Feb 28, 2024
@sorced-jim sorced-jim changed the title Add field information when raising validation errors. style: Add field information when raising validation errors. Feb 28, 2024
@sorced-jim sorced-jim added the kokoro:run Add this label to force Kokoro to re-run the tests. label Feb 28, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Feb 28, 2024
@sorced-jim
Copy link
Contributor

sorced-jim commented Feb 29, 2024

Looks like the tests are failing:
@staticmethod
def test__validate_invalid():
class Mine(model.Model):
foo = model.StringProperty()

    prop = model.StructuredProperty(Mine)
    with pytest.raises(exceptions.BadValueError):

> prop._validate(None)

tests/unit/test_model.py:3013:


self = StructuredProperty(model_class=Mine), value = None

def _validate(self, value):
    if isinstance(value, dict):
        # A dict is assumed to be the result of a _to_dict() call.
        return self._model_class(**value)
    if not isinstance(value, self._model_class):
        raise exceptions.BadValueError(

> "In field {}, expected %s instance, got %s"
% (self._name, self._model_class.__name__, value.__class__)
)
E TypeError: not all arguments converted during string formatting

@sorced-jim sorced-jim added the kokoro:run Add this label to force Kokoro to re-run the tests. label Feb 29, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Feb 29, 2024
@sorced-jim sorced-jim added the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 29, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 29, 2024
@sorced-jim sorced-jim merged commit 17caf0b into googleapis:main Feb 29, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the googleapis/python-ndb API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants