def __init__( self, input_sequences, output_sequence, input_sequence_names, output_sequence_name, elem_type=(int, float), ): self.input_timeseries_collection = [ Timeseries(input_sequence) for input_sequence in check.matrix_param( input_sequences, 'input_sequences', of_type=elem_type ) ] self.output_timeseries = Timeseries(check.list_param(output_sequence, 'output_sequence')) if len(input_sequence_names) != len(self.input_timeseries_collection): raise ValueError("Every timeseries needs a name attached to it.") self.input_timeseries_names = check.list_param( input_sequence_names, 'input_sequence_names', of_type=str ) self.output_timeseries_name = check.str_param(output_sequence_name, 'output_sequence_name')
def test_matrix_param(): assert check.matrix_param([[1, 2], [2, 3]], "something") with pytest.raises(CheckError): assert check.matrix_param(None, "something") with pytest.raises(CheckError): assert check.matrix_param([1, 2, 4], "something") with pytest.raises(CheckError): assert check.matrix_param([], "something") with pytest.raises(CheckError): assert check.matrix_param([[1, 2], 3], "soemthing") with pytest.raises(CheckError): assert check.matrix_param([[1, 2], [3.0, 4.1]], "something", of_type=int) with pytest.raises(CheckError): assert check.matrix_param([[1, 2], [2, 3, 4]], "something")