示例#1
0
def test_short_array_repr():
    cases = [
        np.random.randn(500),
        np.random.randn(20, 20),
        np.random.randn(5, 10, 15),
        np.random.randn(5, 10, 15, 3),
    ]
    # number of lines:
    # for default numpy repr: 167, 140, 254, 248
    # for short_array_repr: 1, 7, 24, 19
    for array in cases:
        num_lines = formatting.short_array_repr(array).count('\n') + 1
        assert num_lines < 30
示例#2
0
def test_short_array_repr():
    cases = [
        np.random.randn(500),
        np.random.randn(20, 20),
        np.random.randn(5, 10, 15),
        np.random.randn(5, 10, 15, 3),
    ]
    # number of lines:
    # for default numpy repr: 167, 140, 254, 248
    # for short_array_repr: 1, 7, 24, 19
    for array in cases:
        num_lines = formatting.short_array_repr(array).count('\n') + 1
        assert num_lines < 30