11"""Tests rig session compatibility check"""
22import unittest
33
4- from aind_data_schema .components .devices import MousePlatform
4+ from aind_data_schema .components .devices import MousePlatform , DAQDevice
55from aind_data_schema .core .rig import Rig
6- from aind_data_schema .core .session import Session
6+ from aind_data_schema .core .session import Session , Stream
77from aind_data_schema .utils .compatibility_check import RigSessionCompatibility
88
99
@@ -12,12 +12,18 @@ class TestRigSessionCompatibility(unittest.TestCase):
1212
1313 # TODO: use example rig and session once examples are synced
1414 mouse_platform = MousePlatform .model_construct (name = "some_mouse_platform" )
15- rig = Rig .model_construct (rig_id = "some_rig_id" , mouse_platform = mouse_platform )
16- compatible_session = Session .model_construct (rig_id = "some_rig_id" , mouse_platform_name = "some_mouse_platform" )
15+ stream1 = Stream .model_construct (daq_names = ["daq1" , "daq2" ])
16+ stream2 = Stream .model_construct (daq_names = ["daq3" , "daq4" ])
17+ daq1 = DAQDevice .model_construct (name = "daq1" )
18+ daq2 = DAQDevice .model_construct (name = "daq2" )
19+ daq3 = DAQDevice .model_construct (name = "daq3" )
20+ rig = Rig .model_construct (rig_id = "some_rig_id" , mouse_platform = mouse_platform , daqs = [daq1 , daq2 , daq3 ])
21+ compatible_session = Session .model_construct (
22+ rig_id = "some_rig_id" , mouse_platform_name = "some_mouse_platform" , data_streams = [stream1 , stream1 ]
23+ )
1724 noncompatible_session = Session .model_construct (
18- rig_id = "some_other_rig_id" , mouse_platform_name = "some_other_mouse_platform"
25+ rig_id = "some_other_rig_id" , mouse_platform_name = "some_other_mouse_platform" , data_streams = [ stream1 , stream2 ]
1926 )
20-
2127 checker = RigSessionCompatibility (rig = rig , session = compatible_session )
2228 noncompatible_checker = RigSessionCompatibility (rig = rig , session = noncompatible_session )
2329
@@ -31,6 +37,11 @@ def test_compare_mouse_platform_name(self):
3137 self .assertIsNone (self .checker ._compare_mouse_platform_name ())
3238 self .assertIsInstance (self .noncompatible_checker ._compare_mouse_platform_name (), ValueError )
3339
40+ def test_compare_daq_names (self ):
41+ """Tests compare daq names"""
42+ self .assertIsNone (self .checker ._compare_daq_names ())
43+ self .assertIsInstance (self .noncompatible_checker ._compare_daq_names (), ValueError )
44+
3445 def test_run_compatibility_check (self ):
3546 """Tests compatibility check"""
3647 self .assertIsNone (self .checker .run_compatibility_check ())
0 commit comments