mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-26 03:38:25 +08:00
added test case for get_experiment() with nested class
Signed-off-by: Leon Riesebos <leon.riesebos@duke.edu>
This commit is contained in:
parent
1deaa758ce
commit
b8f4c6b9bb
@ -116,3 +116,26 @@ class Exp1(EnvExperiment):
|
||||
|
||||
# by elimination
|
||||
self.assertIs(mod.Exp1, tools.get_experiment(mod))
|
||||
|
||||
def test_nested_experiment(self):
|
||||
with create_modules(MODNAME) as mods:
|
||||
with mods[MODNAME].open("a") as fp:
|
||||
print(
|
||||
"""
|
||||
from artiq.experiment import *
|
||||
|
||||
class Foo:
|
||||
class Exp1(EnvExperiment):
|
||||
pass
|
||||
""",
|
||||
file=fp,
|
||||
)
|
||||
|
||||
mod = tools.file_import(str(mods[MODNAME]))
|
||||
|
||||
# by class name
|
||||
self.assertIs(mod.Foo.Exp1, tools.get_experiment(mod, "Foo.Exp1"))
|
||||
|
||||
# by elimination should fail
|
||||
with self.assertRaises(ValueError):
|
||||
tools.get_experiment(mod)
|
||||
|
Loading…
Reference in New Issue
Block a user