Code Duplication    Length = 15-17 lines in 3 locations

tests/test_convert_dataframe.py 3 locations

@@ 48-64 (lines=17) @@
45
        assert_frame_equal(df1, df2, check_dtype=False)
46
47
48
def test_convert_dataframe3():
49
    array = np.reshape(np.arange(20), (10, 2))
50
    df1 = pd.DataFrame(array, columns=["x1", "x2"])
51
52
    search_space1 = {
53
        "x1": list(np.arange(20)),
54
        "x2": list(np.arange(20)),
55
    }
56
    search_space2 = {
57
        "x1": list(np.arange(20)),
58
        # "x2": list(np.arange(20)),
59
    }
60
    df2 = convert_dataframe(df1, search_space1, search_space2)
61
62
    df1.drop("x2", axis=1, inplace=True)
63
64
    assert_frame_equal(df1, df2, check_dtype=False)
65
66
@@ 30-45 (lines=16) @@
27
    assert_frame_equal(df1, df2, check_dtype=False)
28
29
30
def test_convert_dataframe2():
31
    array = np.reshape(np.arange(20), (10, 2))
32
    df1 = pd.DataFrame(array, columns=["x1", "x2"])
33
34
    search_space1 = {
35
        "x1": list(np.arange(20)),
36
        "x2": list(np.arange(20)),
37
    }
38
    search_space2 = {
39
        "x1": list(np.arange(5)),
40
        "x2": list(np.arange(20)),
41
    }
42
    df2 = convert_dataframe(df1, search_space1, search_space2)
43
44
    with pytest.raises(Exception):
45
        assert_frame_equal(df1, df2, check_dtype=False)
46
47
48
def test_convert_dataframe3():
@@ 13-27 (lines=15) @@
10
from optimization_metadata.memory_conv import convert_dataframe
11
12
13
def test_convert_dataframe1():
14
    array = np.reshape(np.arange(20), (10, 2))
15
    df1 = pd.DataFrame(array, columns=["x1", "x2"])
16
17
    search_space1 = {
18
        "x1": list(np.arange(20)),
19
        "x2": list(np.arange(20)),
20
    }
21
    search_space2 = {
22
        "x1": list(np.arange(20)),
23
        "x2": list(np.arange(20)),
24
    }
25
    df2 = convert_dataframe(df1, search_space1, search_space2)
26
27
    assert_frame_equal(df1, df2, check_dtype=False)
28
29
30
def test_convert_dataframe2():