* 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>
Previously, installing graphene and trying to do `from graphene.test import Client`
as recommended in the docs caused an `ImportError`, as the 'promise' library
is imported but only listed as a requirement in the 'test' section of the setup.py
file.
* Vendor DataLoader from aiodataloader and also move get_event_loop behavior from `__init__` to a property which only gets resolved when actually needed (this will solve PyTest-related to early get_event_loop() issues)
* Added DataLoader's specific tests
* plug `loop` parameter into `self._loop`, so that we still have the ability to pass in a custom event loop, if needed.
Co-authored-by: Erik Wrede <erikwrede2@gmail.com>
Providing an invalid value to an input type will now provoke an exception.
For example if the input as the type `UUID` and that you provide the value `2` it will now fail.
assert bar_graphql_type.interfaces == [foo_graphql_type] failed only on tox, because .interfaces was a tuple instead of a list. Error didn't occur using just pytest. Fixed by explicitly
converting both to list.
This is to match the `graphql-core` API. If it's not respected
the `parse_literal` method will produce an error event though
dealing with a valid value.
The code example in docstring starts with `from graphene import Mutation` and defines a `class Mutation` later. This definition would shadow previously imported name and (which is more important) confuses a reader about usage of this class — one need to keep in mind that previous usage of `Mutation` is imported from graphene and have not been overridden yet.
This PR changes an import-from statement to an import statement, so `graphene.Mutation` is used explicitly. This approach is consistent with other code examples in docs (e. g. https://docs.graphene-python.org/en/v2.1.9/types/mutations/).
Another option is to change name of example class Mutation to something more clear (maybe SchemaMutation or RootMutation), but I'm not sure what name to choose.
Only docstring is updated, no code changes.