File: test_merge_kwargs.py

package info (click to toggle)
graphql-core 3.2.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,384 kB
  • sloc: python: 45,812; makefile: 26; sh: 13
file content (24 lines) | stat: -rw-r--r-- 605 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from graphql.pyutils import merge_kwargs

try:
    from typing import TypedDict
except ImportError:  # Python < 3.8
    from typing_extensions import TypedDict


class FooDict(TypedDict):
    foo: str
    bar: str
    baz: int


def describe_merge_kwargs():
    def should_merge_with_no_kwargs():
        base = FooDict(foo="foo", bar="bar", baz=0)
        assert merge_kwargs(base) == base

    def should_merge_with_kwargs():
        base = FooDict(foo="foo", bar="bar", baz=0)
        assert merge_kwargs(base, foo="moo", bar="mar", baz=1) == FooDict(
            foo="moo", bar="mar", baz=1
        )