Skip to content

Commit

Permalink
Add unparsed test to test_cast
Browse files Browse the repository at this point in the history
  • Loading branch information
lpetre committed Nov 17, 2021
1 parent 3dbd5c9 commit 1ec78be
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions libcst/metadata/tests/test_scope_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -1760,6 +1760,30 @@ def assert_parsed(code, *calls):
mock.call("int"),
)

assert_parsed(
"""
from typing import TypeVar
TypeVar("Name", func("int"))
""",
)

assert_parsed(
"""
from typing import Literal
Literal[\"G\"]
""",
)

assert_parsed(
r"""
from typing import TypeVar, Optional
from a import G
TypeVar("G2", bound="Optional[\"G\"]")
""",
mock.call("Optional[\"G\"]"),
mock.call("G"),
)

def test_builtin_scope(self) -> None:
m, scopes = get_scope_metadata_provider(
"""
Expand Down Expand Up @@ -1826,6 +1850,3 @@ def foo():

global_pow_accesses = list(global_pow_assignment.references)
self.assertEqual(len(global_pow_accesses), 2)

def test_unparseable_string(self) -> None:
m, scopes = get_scope_metadata_provider('a: Optional[func("{hello{foo}}")]')

0 comments on commit 1ec78be

Please sign in to comment.