| 1 |
from graphql.pyutils import merge_kwargs |
| 2 |
|
| 3 |
try: |
| 4 |
from typing import TypedDict |
| 5 |
except ImportError: # Python < 3.8 |
| 6 |
from typing_extensions import TypedDict |
| 7 |
|
| 8 |
|
| 9 |
class FooDict(TypedDict): |
| 10 |
foo: str |
| 11 |
bar: str |
| 12 |
baz: int |
| 13 |
|
| 14 |
|
| 15 |
def describe_merge_kwargs(): |
| 16 |
def should_merge_with_no_kwargs(): |
| 17 |
base = FooDict(foo="foo", bar="bar", baz=0) |
| 18 |
assert merge_kwargs(base) == base |
| 19 |
|
| 20 |
def should_merge_with_kwargs(): |
| 21 |
base = FooDict(foo="foo", bar="bar", baz=0) |
| 22 |
assert merge_kwargs(base, foo="moo", bar="mar", baz=1) == FooDict( |
| 23 |
foo="moo", bar="mar", baz=1 |
| 24 |
) |