Skip to content

Commit

Permalink
Add stim.GateData.{is_symmetric_gate,hadamard_conjugated}
Browse files Browse the repository at this point in the history
- Add some missing example sections to docstrings
- Add a warning about missing example sections when running documentation tests
- Add `stim.GateData.is_symmetric_gate`
- Add `stim.GateData.hadamard_conjugated(unsigned=False)`
- Add `stim.DemTarget.__init__` with support for parsing strings

Fixes #795
  • Loading branch information
Strilanc committed Jul 14, 2024
1 parent 0685b5a commit fefb4f7
Show file tree
Hide file tree
Showing 17 changed files with 1,592 additions and 75 deletions.
7 changes: 7 additions & 0 deletions dev/doctest_proper.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ def main():
module = __import__(module_name)
out = {}
gen(obj=module, fullname=module_name, out=out)
for k, v in out.items():
v = v.__doc__.lower()
if '\n' in v.strip() and 'examples:' not in v and 'example:' not in v and '[deprecated]' not in v:
if k.split('.')[-1] not in ['__next__', '__iter__', '__init_subclass__', '__module__', '__eq__', '__ne__', '__str__', '__repr__']:
if all(not (e.startswith('_') and not e.startswith('__')) for e in k.split('.')):
print(f" Warning: Missing 'examples:' section in docstring of {k!r}", file=sys.stderr)

module.__test__ = {k: v for k, v in out.items()}
if doctest.testmod(module, globs=globs).failed:
any_failed = True
Expand Down
Loading

0 comments on commit fefb4f7

Please sign in to comment.