# This sample tests the type analyzer's handling of a variant
# of the TypedDict "alternate syntax" defined in the Python docs.

from typing import TypedDict

Movie = TypedDict("Movie", name=str, year=int)


def get_movie_name(movie: Movie):
    return movie["name"]


name2 = get_movie_name({"name": "ET", "year": 1982})

movie1: Movie = {"name": "<NAME>", "year": 1982}

movie2: Movie = {
    "name": "<NAME>",
    # This should generate an error because
    # the type is incorrect.
    "year": "1982",
}

movie3: Movie = {
    # This should generate an error because
    # all keys are required.
    "name": "<NAME>"
}

movie4: Movie = {
    # This should generate an error because
    # the key name is not supported.
    "name2": "<NAME>"
}

# This sample tests the type analyzer's handling of a variant
# of the TypedDict "alternate syntax" defined in the Python docs.

from typing import TypedDict

Movie = TypedDict("Movie", name=str, year=int)


def get_movie_name(movie: Movie):
    return movie["name"]


name2 = get_movie_name({"name": "ET", "year": 1982})

movie1: Movie = {"name": "<NAME>", "year": 1982}

movie2: Movie = {
    "name": "<NAME>",
    # This should generate an error because
    # the type is incorrect.
    "year": "1982",
}

movie3: Movie = {
    # This should generate an error because
    # all keys are required.
    "name": "<NAME>"
}

movie4: Movie = {
    # This should generate an error because
    # the key name is not supported.
    "name2": "<NAME>"
}

# This sample tests the type analyzer's handling of a variant # of the TypedDict "alternate syntax" defined in the Python docs. # This should generate an error because # the type is incorrect. # This should generate an error because # all keys are required. # This should generate an error because # the key name is not supported.