* Do not raise AttributeError when parsing non-string UUIDs
When a user sends a dictionary or other object as a UUID variable like `{[123]}`, previously graphene crashed with an `AttributeError`, like this:
```
(…)
File "…/lib/python3.12/site-packages/graphql/utils/is_valid_value.py", line 78, in is_valid_value
parse_result = type.parse_value(value)
^^^^^^^^^^^^^^^^^^^^^^^
File "…/lib/python3.12/site-packages/graphene/types/uuid.py", line 33, in parse_value
return _UUID(value)
^^^^^^^^^^^^
File "/usr/lib/python3.12/uuid.py", line 175, in __init__
hex = hex.replace('urn:', '').replace('uuid:', '')
^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'replace'
```
But an `AttributeError` makes it seem like this is the server's fault, when it's obviously the client's.
Report a proper GraphQLError.
* fix: adjust exception message structure
---------
Co-authored-by: Erik Wrede <erikwrede@users.noreply.github.com>
This PR makes the Union Options configurable, similar to how it works with ObjectTypes
---------
Co-authored-by: Erik Wrede <erikwrede@users.noreply.github.com>
* actually run the tests in python 3.12 and 3.13
* remove snapshottest from the example tests
so that the tests pass in 3.12 and 3.13 again
* remove the section about snapshot testing from the testing docs
because the snapshottest package doesn't work on Python 3.12 and above
* fix assertion for badly formed JSON input on Python 3.13
* fix deprecation warning about datetime.utcfromtimestamp()
pytest: Don't use nose like syntax
The tests in test_custom_global_id.py use the old nose specific method
'setup(self)' which isn't supported anymore in Pytest 8+. The tests fail
with this error message without modification.
E pytest.PytestRemovedIn8Warning: Support for nose tests is deprecated and will be removed in a future release.
E graphene/relay/tests/test_custom_global_id.py::TestIncompleteCustomGlobalID::test_must_define_resolve_global_id is using nose-specific method: `setup(self)`
E To remove this warning, rename it to `setup_method(self)`
E See docs: https://docs.pytest.org/en/stable/deprecations.html#support-for-tests-written-for-nose
Co-authored-by: Erik Wrede <erikwrede@users.noreply.github.com>
* test [1293]: regression test print schema with InputObjectType with DateTime field with default_value
* chore: clarify test title and assertion
---------
Co-authored-by: Erik Wrede <erikwrede@users.noreply.github.com>
* Corrected enum metaclass to fix pickle.dumps()
* considered case with colliding class names (try to distinguish by file name)
* reverted simple solution back (without attempt to support duplicate Enum class names)
---------
Co-authored-by: sgrekov <sgrekov@lohika.com>
Co-authored-by: Erik Wrede <erikwrede@users.noreply.github.com>
* Changed InputObjectType's default builder-from-dict argument to be `Undefined` instead of `None`, removing ambiguity of undefined optional inputs using dot notation access syntax.
* Move `set_default_input_object_type_to_undefined()` fixture into conftest.py for sharing it between multiple test files.
* Default enum description to "An enumeration."
default to this string, which is used in many tests, is causing
* Use the docstring descriptions of enums when they are present
* Added tests
* chore: add missing newline
* Fix new line
---------
Co-authored-by: Erik Wrede <erikwrede@users.noreply.github.com>