-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from qua-platform/fix/quam-root-referencing
Fix: Referencing issues in Quam Root
- Loading branch information
Showing
4 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.