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

Fix: Referencing issues in Quam Root #93

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [Unreleased]
### Fixed
- Fixed issues with parameters being references in a QuamRoot object

## [0.3.8]
### Added
- Added time tagging to channels
Expand Down
3 changes: 0 additions & 3 deletions quam/core/quam_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,9 +682,6 @@ def generate_config(self) -> Dict[str, Any]:

return qua_config

def get_unreferenced_value(self, attr: str):
return getattr(self, attr)


class QuamComponent(QuamBase):
"""Base class for any QuAM component class.
Expand Down
32 changes: 32 additions & 0 deletions tests/quam_base/referencing/test_quam_root_referencing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from quam import QuamRoot, QuamComponent, quam_dataclass
import warnings


@quam_dataclass
class Component(QuamComponent):
y: int = 2


@quam_dataclass
class Root(QuamRoot):
a: Component
b: Component = "#/a"


def test_quam_root_reference():
with warnings.catch_warnings():
warnings.simplefilter("error")
root = Root(a=Component())
assert root.a is root.b


def test_quam_root_reference_to_dict():
with warnings.catch_warnings():
warnings.simplefilter("error")
root = Root(a="#/b", b=Component())
d = root.to_dict()
assert d == {
"a": "#/b",
"b": {},
"__class__": "test_quam_root_referencing.Root",
}
File renamed without changes.
Loading