def test_common_timebase_errors(self, i1, i2): """Test that common_timbase raises errors on invalid combinations""" with pytest.raises(ValueError): common_timebase(i1, i2) # Make sure behaviour is symmetric with pytest.raises(ValueError): common_timebase(i2, i1)
def test_common_timebase(self, dt1, dt2, expected, sys1, sys2): """Test that common_timbase adheres to :ref:`conventions-ref`""" i1 = tf([1], [1, 2, 3], dt1) if sys1 else dt1 i2 = tf([1], [1, 4, 5], dt2) if sys2 else dt2 assert common_timebase(i1, i2) == expected # Make sure behaviour is symmetric assert common_timebase(i2, i1) == expected
def testCompatibleTimebases(self, tsys): """test that compatible timebases don't throw errors and vice versa""" common_timebase(tsys.siso_ss1.dt, tsys.siso_tf1.dt) common_timebase(tsys.siso_ss1.dt, tsys.siso_ss1c.dt) common_timebase(tsys.siso_ss1d.dt, tsys.siso_ss1.dt) common_timebase(tsys.siso_ss1.dt, tsys.siso_ss1d.dt) common_timebase(tsys.siso_ss1.dt, tsys.siso_ss1d.dt) common_timebase(tsys.siso_ss1d.dt, tsys.siso_ss3d.dt) common_timebase(tsys.siso_ss3d.dt, tsys.siso_ss1d.dt) with pytest.raises(ValueError): # cont + discrete common_timebase(tsys.siso_ss1d.dt, tsys.siso_ss1c.dt) with pytest.raises(ValueError): # incompatible discrete common_timebase(tsys.siso_ss1d.dt, tsys.siso_ss2d.dt)