def test_onestep(inputs): """ Test the outermost onestep function exposed for direct estimation """ seq_x, seq_y = inputs out_x1, out_y1, _ = onestep.onestep( seq_x, seq_y, order=2, verbose=False, check=False ) outputs = onestep.onestep(seq_x, seq_y, order=2, verbose=True, check=False) out_x2, out_y2 = outputs[0], outputs[1] # Substituted sequence should be shorter than input assert len(out_x1) < len(seq_x) and len(out_y1) < len(seq_y) # Highest value in substituted sequence should be greater than that in input assert max(out_x1) > max(seq_x) and max(out_y1) > max(seq_y) # Smallest value in substituted sequence should be at least as large as that in input assert min(out_x1) >= min(seq_x) and min(out_y1) >= min(seq_y) # Number of unique symbols in output should be one less than that in input assert len(set(out_x1) - set(seq_x)) == 1 assert len(set(out_y1) - set(seq_y)) == 1 # Number of symbols in output that are not in input should be between 1 and 3 assert 1 <= len(set(out_x1) ^ set(seq_x)) <= 3 assert 1 <= len(set(out_y1) ^ set(seq_y)) <= 3 # Changing verbosity parameter should not alter the substituted sequence assert out_x1 == out_x2 and out_y1 == out_y2
def test_onestep_invalid_str(): """ Test the outermost onestep function for invalid input: string inputs """ output = onestep.onestep( [1, 2, 3, 4, 5, 6], "abcdef", 2, verbose=False, check=False ) assert output is None output = onestep.onestep( "abcdef", [1, 2, 3, 4, 5, 6], 2, verbose=False, check=False ) assert output is None output = onestep.onestep("abcdef", "abcdef", 2, verbose=False, check=False) assert output is None
def test_onestep_invalid(inputs): """ Test the outermost onestep function for invalid input: sequences shorter than order """ seq_x, seq_y = inputs output = onestep.onestep(seq_x[:1], seq_y[:1], order=2, verbose=False, check=False) assert output is None
def test_onestep_identical(inputs): """ Test the outermost onestep function for sequence with identical symbols """ seq_x, seq_y = inputs output = onestep.onestep(seq_x, seq_y, order=2, verbose=False, check=True) assert output is None