AndreaCensi/contracts

attr() doesn't seem to work with attributes that have an underscore in their name.

Opened this issue · 0 comments

attr() doesn't seem to work with attributes that have an underscore in their name.

For example:

from contracts import contract

class A:
    b = 3
    b_2 = 4

@contract(a="attr(b:int)")  # Works.
def foo(a: A) -> None:
    pass

foo(A())

@contract(a="attr(b_2:int)")  # AssertionError: Bug in syntax
def foo2(a: A) -> None:
    pass

foo2(A())