-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
140 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from __future__ import annotations | ||
|
||
from dataclasses import dataclass | ||
import os | ||
from typing import get_type_hints | ||
from typing import Text | ||
|
||
import dataconf | ||
from dataconf.main import inject_callee_scope | ||
|
||
|
||
@inject_callee_scope | ||
def out_of_scope_assert(clazz, expected, globalns, localns): | ||
assert get_type_hints(clazz, globalns, localns)["a"] is expected | ||
|
||
|
||
class TestFuturAnnotations: | ||
def test_43(self) -> None: | ||
@dataclass | ||
class Model: | ||
token: str | ||
|
||
os.environ["TEST_token"] = "1" | ||
dataconf.env("TEST_", Model) | ||
|
||
def test_repro(self) -> None: | ||
@dataclass | ||
class A: | ||
value: Text | ||
|
||
@dataclass | ||
class B: | ||
a: A | ||
|
||
out_of_scope_assert(B, A, globalns={}) |