示例#1
0
def test_find_data_segment_with_nested_list_pattern_and_multiple_variables():
    data = "A = [3]; X = [[0, 1, 0], [0, 0, 1]];"
    pattern = get_nested_list_pattern()
    assert find_data_segment(data, "X", pattern) == "[[0, 1, 0], [0, 0, 1]]"
示例#2
0
def test_find_data_segment_with_list_of_strings_pattern_with_multiple_variables(
):
    data = 'A = ["b", "a"]; BB = ["z", "zz", "zzz"];'
    pattern = get_list_of_strings_pattern()
    assert find_data_segment(data, "BB", pattern) == '["z", "zz", "zzz"]'
示例#3
0
def test_find_data_segment_with_nested_list_pattern():
    data = "Z = [[1, 1, 0], [0, 0, 1]];"
    pattern = get_nested_list_pattern()
    assert find_data_segment(data, "Z", pattern) == "[[1, 1, 0], [0, 0, 1]]"
示例#4
0
def test_find_data_segment_with_list_of_strings_pattern():
    data = 'A = ["xyz", "zyx"];'
    pattern = get_list_of_strings_pattern()
    assert find_data_segment(data, "A", pattern) == '["xyz", "zyx"]'
示例#5
0
def test_find_data_segment_with_list_of_floats_pattern_and_multiple_variables(
):
    pattern = get_list_of_floats_pattern()
    assert find_data_segment("A = [1]; B = [2, 3];", "B", pattern) == "[2, 3]"
示例#6
0
def test_find_data_segment_with_list_of_floats_pattern():
    pattern = get_list_of_floats_pattern()
    assert find_data_segment("A = [9, 8];", "A", pattern) == "[9, 8]"
示例#7
0
def test_find_data_segment_with_int_pattern_and_multiple_variables():
    assert find_data_segment("A = 88; B = 9;", "B", get_float_pattern()) == "9"
示例#8
0
def test_find_data_segment_with_int_pattern():
    assert find_data_segment("A = 123;", "A", get_float_pattern()) == "123"