def test_no_channels_in_container(self, mock_get_channel_ids): """Return empty list if channel_ids list is empty """ mock_get_channel_ids.return_value = [] gwyfile = Mock(spec=Gwyfile) channels = GwyContainer._dump_channels(gwyfile) self.assertEqual(channels, [])
def test_convert_channel_ids_to_GwyChannel_list(self, mock_get_channel_ids, mock_GwyChannel): """Convert list of channel_ids to list of GwyChannel objects and return the latter """ channel_ids = [0, 1, 2] mock_get_channel_ids.return_value = channel_ids gwyfile = Mock(spec=Gwyfile) channels = GwyContainer._dump_channels(gwyfile) self.assertListEqual(channels, [mock_GwyChannel.from_gwy(gwyfile, channel_id) for channel_id in channel_ids])