-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathconftest.py
More file actions
33 lines (25 loc) · 702 Bytes
/
Copy pathconftest.py
File metadata and controls
33 lines (25 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os
import sys
import control
import pytest
from discretetf import DiscreteTF
@pytest.fixture
def Ts():
""" Simulink time step. """
return 1e-3
@pytest.fixture(scope="function")
def mdl():
"""Pytest fixture for the model.
Run the initialize function before handing off the model
Run the terminate function after recieving the model.
This ensures that each test has the same starting model state.
"""
mdl = DiscreteTF()
mdl.initialize()
yield mdl
mdl.terminate()
@pytest.fixture(scope="function")
def sysd(Ts):
""" python-control discrete transfer function """
sys = control.TransferFunction([3], [2, 1])
return control.c2d(sys, Ts)