Skip to content

Commit

Permalink
checks updates
Browse files Browse the repository at this point in the history
  • Loading branch information
idavis committed Oct 15, 2024
1 parent 27e8359 commit 275da26
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions pyqir/tests/test_value_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,18 @@ def test_int_variable() -> None:


def test_function_name_can_contain_spaces_and_chars() -> None:
mod = pyqir.SimpleModule("test", 0, 0)
simple_mod = pyqir.SimpleModule("test", 0, 0)
expected = "Some - ; name fin"
mod.entry_point.name = expected
simple_mod.entry_point.name = expected

# verify the name is use and wrapped in quotes
assert f'@"{expected}"() #0' in mod.ir()
ir = simple_mod.ir()
assert f'@"{expected}"() #0' in ir

# verify we can find it by name without having to use quotes
func = next(filter(lambda f: f.name == expected, mod._module.functions))
assert func == mod.entry_point
func = next(filter(lambda f: f.name == expected, simple_mod._module.functions))
assert func == simple_mod.entry_point

# Double check that the module is valid with this kind of name
mod = pyqir.Module.from_ir(Context(), mod.ir())
mod = pyqir.Module.from_ir(Context(), ir)
assert mod.verify() is None

0 comments on commit 275da26

Please sign in to comment.