Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variables for dependent domains #3

Open
svivek opened this issue May 30, 2021 · 0 comments
Open

Variables for dependent domains #3

svivek opened this issue May 30, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@svivek
Copy link
Member

svivek commented May 30, 2021

The following test fails:

def test_dependent_variables():
    fillers = {
        "person": [
            {"name": "Jack", "pronoun": "he", "noun": "man"},
            {"name": "Jill", "pronoun": "she", "noun": "woman"},
        ],
        "location": ["New York", "Chicago"],
    }
    template = '{{name}} {{p | type("pronoun")}} {{noun}} {{p}}'

    m = MadLibTemplate(template, fillers)
    generated = m.render({"name": "Jack", "pronoun": "he", "noun": "man"})
    assert generated == "Jack he man he"

The expected behavior is that the variable p in the template should be reused, but the template creation fails with an Exception: Unknown domain for p, probably because there is so much hard coding in how variables for dependent domains are handled.

@svivek svivek added the bug Something isn't working label May 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant