Skip to content

Commit

Permalink
Fix tests and actually set duration to None
Browse files Browse the repository at this point in the history
  • Loading branch information
terrorfisch committed Jul 8, 2021
1 parent f6940fd commit 032b65a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions qupulse/pulses/multi_channel_pulse_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def __init__(self,
if duration in (True, False):
warnings.warn("Boolean duration is deprecated since qupulse 0.6 and interpreted as None",
category=DeprecationWarning, stacklevel=2)
duration = None

for subtemplate in self._subtemplates:
if isinstance(subtemplate, AtomicPulseTemplate):
Expand Down
9 changes: 4 additions & 5 deletions tests/pulses/multi_channel_pulse_template_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ def test_non_atomic_subtemplates(self):
with self.assertRaises(TypeError):
AtomicMultiChannelPulseTemplate((non_atomic_pt, {'A': 'C'}), atomic_pt)

@unittest.skip("This test is skipped because the init check was removed. We keep the code around here because there"
" are plans to introduce a runtime warning instead which could be tested with a few modifications.")
def test_instantiation_duration_check(self):
subtemplates = [DummyPulseTemplate(parameter_names={'p1'},
measurement_names={'m1'},
Expand All @@ -87,10 +85,11 @@ def test_instantiation_duration_check(self):
duration='t_3',
waveform=DummyWaveform(duration=4, defined_channels={'c3'}))]

with self.assertRaisesRegex(ValueError, 'duration equality'):
AtomicMultiChannelPulseTemplate(*subtemplates)
# with self.assertRaisesRegex(ValueError, 'duration equality'):
# AtomicMultiChannelPulseTemplate(*subtemplates)

amcpt = AtomicMultiChannelPulseTemplate(*subtemplates, duration=True)
with self.assertWarns(DeprecationWarning):
amcpt = AtomicMultiChannelPulseTemplate(*subtemplates, duration=True)
self.assertIs(amcpt.duration, subtemplates[0].duration)

with self.assertRaisesRegex(ValueError, 'duration'):
Expand Down

0 comments on commit 032b65a

Please sign in to comment.