forked from M-Labs/artiq
fix transforms unittest
This commit is contained in:
parent
0b8d496b62
commit
c98e08fe36
|
@ -6,8 +6,7 @@ from artiq.coredevice.runtime import LinkInterface
|
||||||
|
|
||||||
|
|
||||||
class _RuntimeEnvironment(LinkInterface):
|
class _RuntimeEnvironment(LinkInterface):
|
||||||
def __init__(self, ref_period):
|
def __init__(self):
|
||||||
self.internal_ref_period = ref_period
|
|
||||||
self.warmup_time = 1*ms
|
self.warmup_time = 1*ms
|
||||||
|
|
||||||
def emit_object(self):
|
def emit_object(self):
|
||||||
|
@ -16,7 +15,7 @@ class _RuntimeEnvironment(LinkInterface):
|
||||||
|
|
||||||
class Comm(AutoDB):
|
class Comm(AutoDB):
|
||||||
def get_runtime_env(self):
|
def get_runtime_env(self):
|
||||||
return _RuntimeEnvironment(1*ns)
|
return _RuntimeEnvironment()
|
||||||
|
|
||||||
def switch_clock(self, external):
|
def switch_clock(self, external):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import unittest
|
import unittest
|
||||||
import ast
|
import ast
|
||||||
|
|
||||||
|
from artiq import ns
|
||||||
from artiq.coredevice import comm_dummy, core
|
from artiq.coredevice import comm_dummy, core
|
||||||
from artiq.transforms.unparse import unparse
|
from artiq.transforms.unparse import unparse
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ def run():
|
||||||
|
|
||||||
class OptimizeCase(unittest.TestCase):
|
class OptimizeCase(unittest.TestCase):
|
||||||
def test_optimize(self):
|
def test_optimize(self):
|
||||||
coredev = core.Core(comm=comm_dummy.Comm())
|
coredev = core.Core(comm=comm_dummy.Comm(), ref_period=1*ns)
|
||||||
func_def = ast.parse(optimize_in).body[0]
|
func_def = ast.parse(optimize_in).body[0]
|
||||||
coredev.transform_stack(func_def, dict(), dict())
|
coredev.transform_stack(func_def, dict(), dict())
|
||||||
self.assertEqual(unparse(func_def), optimize_out)
|
self.assertEqual(unparse(func_def), optimize_out)
|
||||||
|
|
Loading…
Reference in New Issue