0370917c6e71a01dbe1260c92e10147eac653e5d,scipy/weave/tests/test_blitz_tools.py,,test_blitz_bug,#,163

Before Change


        blitz(expr_buggy.format(lim))
        blitz(expr_not_buggy.format(lim, "sh"))
        if old_env is None:
            os.environ.pop("PYTHONCOMPILED")
        else:
            os.environ["PYTHONCOMPILED"] = old_env

        arr_np[lim:] = arr[lim:]

After Change


@dec.slow
def test_blitz_bug():
    // Assignment to arr[i:] used to fail inside blitz expressions.
    with TempdirBlitz():
        N = 4
        expr_buggy = "arr_blitz_buggy[{0}:] = arr[{0}:]"
        expr_not_buggy = "arr_blitz_not_buggy[{0}:{1}] = arr[{0}:]"
        random.seed(7)
        arr = random.randn(N)
        sh = arr.shape[0]
        for lim in [0, 1, 2]:
            arr_blitz_buggy = zeros(N)
            arr_blitz_not_buggy = zeros(N)
            arr_np = zeros(N)
            blitz(expr_buggy.format(lim))
            blitz(expr_not_buggy.format(lim, "sh"))
            arr_np[lim:] = arr[lim:]
            assert_allclose(arr_blitz_buggy, arr_np)
            assert_allclose(arr_blitz_not_buggy, arr_np)


if __name__ == "__main__":
    run_module_suite()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: scipy/scipy
Commit Name: 0370917c6e71a01dbe1260c92e10147eac653e5d
Time: 2014-02-16
Author: ralf.gommers@googlemail.com
File Name: scipy/weave/tests/test_blitz_tools.py
Class Name:
Method Name: test_blitz_bug


Project Name: dmlc/dgl
Commit Name: af61e2fbb45c53df3ff2a91f81a2026a8f66d90d
Time: 2020-03-29
Author: expye@outlook.com
File Name: python/dgl/nn/pytorch/conv/nnconv.py
Class Name: NNConv
Method Name: forward


Project Name: apache/incubator-mxnet
Commit Name: 02ae456ef0e4eef86455b0a39d5ccabfd5b29668
Time: 2020-07-23
Author: dick.carter@comcast.net
File Name: tests/python/unittest/test_engine_import.py
Class Name:
Method Name: test_engine_import


Project Name: scipy/scipy
Commit Name: ba58448e0e3f5be1663e32aefad2c0c07c541da8
Time: 2013-01-05
Author: ralf.gommers@googlemail.com
File Name: scipy/signal/tests/test_spectral.py
Class Name: TestWelch
Method Name: test_short_data