Skip to content

Commit

Permalink
Update test to include build_without_init
Browse files Browse the repository at this point in the history
  • Loading branch information
rwhitten577 authored and elijahbenizzy committed Nov 6, 2024
1 parent 5cc2bfd commit a617bbd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_async_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,21 @@ def foo() -> int:

assert "Cannot define function foo more than once." in str(e.value)

# build_without_init should also raise
with pytest.raises(ValueError) as e:
async_driver.Builder().with_modules(mod1, mod2).build_without_init()

assert "Cannot define function foo more than once." in str(e.value)

# Should not raise with .allow_module_overrides()
dr = await async_driver.Builder().with_modules(mod1, mod2).allow_module_overrides().build()
assert (await dr.execute(final_vars=["foo"])) == {"foo": 2}

# Same with build_without_init
dr = (
async_driver.Builder()
.with_modules(mod1, mod2)
.allow_module_overrides()
.build_without_init()
)
assert (await dr.execute(final_vars=["foo"])) == {"foo": 2}

0 comments on commit a617bbd

Please sign in to comment.