Closed TheDataLeek closed 8 years ago
So, looking at this problem a lot more closely, it's rather due to something not quite working with the List
type. As an example of demonstrated behavior:
@runtime_validation
def foo(x: List[str]) -> str:
return x[0]
foo(['a', 2, 3]) # This will work because the first element is str
foo([1, 2, 3]) # This will fail which is good
Will continue to update as I isolate the problem. I think it's something to do with how the parser sets up the TypeTree.
This is actually fixed. Closing the issue.
In the current iteration of the
dev
branch,Union
type hints are not enforced correctly in certain situations (generally ones where there is nesting involved). The following example does not throw an error.I'm working on debugging it as well.