prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  DeprecationWarnings in stats on python 3.5
  ```
  /home/br/repos/scipy/build/testenv/lib/python3.5/site-packages/scipy/stats/tests/test_stats.py:101: DeprecationWarning: Please use assertRaisesRegex instead.
  ```
  
  Apparently, `assertRaisesRegexp` was renamed to `assertRaisesRegex`:  https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertRaisesRegexp
  
  
  </issue>
  <code>
  [start of scipy/_lib/_numpy_compat.py]
  1 """Functions copypasted from newer versions of numpy.
  2 
  3 """
  4 from __future__ import division, print_function, absolute_import
  5 
  6 import warnings
  7 
  8 import numpy as np
  9 
  10 from scipy._lib._version import NumpyVersion
  11 
  12 if NumpyVersion(np.__version__) > '1.7.0.dev':
  13     _assert_warns = np.testing.assert_warns
  14 else:
  15     def _assert_warns(warning_class, func, *args, **kw):
  16         r"""
  17         Fail unless the given callable throws the specified warning.
  18 
  19         This definition is copypasted from numpy 1.9.0.dev.
  20         The version in earlier numpy returns None.
  21 
  22         Parameters
  23         ----------
  24         warning_class : class
  25             The class defining the warning that `func` is expected to throw.
  26         func : callable
  27             The callable to test.
  28         *args : Arguments
  29             Arguments passed to `func`.
  30         **kwargs : Kwargs
  31             Keyword arguments passed to `func`.
  32 
  33         Returns
  34         -------
  35         The value returned by `func`.
  36 
  37         """
  38         with warnings.catch_warnings(record=True) as l:
  39             warnings.simplefilter('always')
  40             result = func(*args, **kw)
  41             if not len(l) > 0:
  42                 raise AssertionError("No warning raised when calling %s"
  43                         % func.__name__)
  44             if not l[0].category is warning_class:
  45                 raise AssertionError("First warning for %s is not a "
  46                         "%s( is %s)" % (func.__name__, warning_class, l[0]))
  47         return result
  48
  [end of scipy/_lib/_numpy_compat.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/scipy/_lib/_numpy_compat.py b/scipy/_lib/_numpy_compat.py
  --- a/scipy/_lib/_numpy_compat.py
  +++ b/scipy/_lib/_numpy_compat.py
  @@ -4,8 +4,10 @@
   from __future__ import division, print_function, absolute_import
   
   import warnings
  +import sys
   
   import numpy as np
  +from numpy.testing.nosetester import import_nose
   
   from scipy._lib._version import NumpyVersion
   
  @@ -45,3 +47,28 @@
                   raise AssertionError("First warning for %s is not a "
                           "%s( is %s)" % (func.__name__, warning_class, l[0]))
           return result
  +
  +
  +def assert_raises_regex(exception_class, expected_regexp,
  +                        callable_obj=None, *args, **kwargs):
  +    """
  +    Fail unless an exception of class exception_class and with message that
  +    matches expected_regexp is thrown by callable when invoked with arguments
  +    args and keyword arguments kwargs.
  +    Name of this function adheres to Python 3.2+ reference, but should work in
  +    all versions down to 2.6.
  +    Notes
  +    -----
  +    .. versionadded:: 1.8.0
  +    """
  +    __tracebackhide__ = True  # Hide traceback for py.test
  +    nose = import_nose()
  +
  +    if sys.version_info.major >= 3:
  +        funcname = nose.tools.assert_raises_regex
  +    else:
  +        # Only present in Python 2.7, missing from unittest in 2.6
  +            funcname = nose.tools.assert_raises_regexp
  +
  +    return funcname(exception_class, expected_regexp, callable_obj,
  +                    *args, **kwargs)
  
verification_info: {"golden_diff": "diff --git a/scipy/_lib/_numpy_compat.py b/scipy/_lib/_numpy_compat.py\n--- a/scipy/_lib/_numpy_compat.py\n+++ b/scipy/_lib/_numpy_compat.py\n@@ -4,8 +4,10 @@\n from __future__ import division, print_function, absolute_import\n \n import warnings\n+import sys\n \n import numpy as np\n+from numpy.testing.nosetester import import_nose\n \n from scipy._lib._version import NumpyVersion\n \n@@ -45,3 +47,28 @@\n                 raise AssertionError(\"First warning for %s is not a \"\n                         \"%s( is %s)\" % (func.__name__, warning_class, l[0]))\n         return result\n+\n+\n+def assert_raises_regex(exception_class, expected_regexp,\n+                        callable_obj=None, *args, **kwargs):\n+    \"\"\"\n+    Fail unless an exception of class exception_class and with message that\n+    matches expected_regexp is thrown by callable when invoked with arguments\n+    args and keyword arguments kwargs.\n+    Name of this function adheres to Python 3.2+ reference, but should work in\n+    all versions down to 2.6.\n+    Notes\n+    -----\n+    .. versionadded:: 1.8.0\n+    \"\"\"\n+    __tracebackhide__ = True  # Hide traceback for py.test\n+    nose = import_nose()\n+\n+    if sys.version_info.major >= 3:\n+        funcname = nose.tools.assert_raises_regex\n+    else:\n+        # Only present in Python 2.7, missing from unittest in 2.6\n+            funcname = nose.tools.assert_raises_regexp\n+\n+    return funcname(exception_class, expected_regexp, callable_obj,\n+                    *args, **kwargs)\n", "issue": "DeprecationWarnings in stats on python 3.5\n```\n/home/br/repos/scipy/build/testenv/lib/python3.5/site-packages/scipy/stats/tests/test_stats.py:101: DeprecationWarning: Please use assertRaisesRegex instead.\n```\n\nApparently, `assertRaisesRegexp` was renamed to `assertRaisesRegex`:  https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertRaisesRegexp\n\n", "before_files": [{"content": "\"\"\"Functions copypasted from newer versions of numpy.\n\n\"\"\"\nfrom __future__ import division, print_function, absolute_import\n\nimport warnings\n\nimport numpy as np\n\nfrom scipy._lib._version import NumpyVersion\n\nif NumpyVersion(np.__version__) > '1.7.0.dev':\n    _assert_warns = np.testing.assert_warns\nelse:\n    def _assert_warns(warning_class, func, *args, **kw):\n        r\"\"\"\n        Fail unless the given callable throws the specified warning.\n\n        This definition is copypasted from numpy 1.9.0.dev.\n        The version in earlier numpy returns None.\n\n        Parameters\n        ----------\n        warning_class : class\n            The class defining the warning that `func` is expected to throw.\n        func : callable\n            The callable to test.\n        *args : Arguments\n            Arguments passed to `func`.\n        **kwargs : Kwargs\n            Keyword arguments passed to `func`.\n\n        Returns\n        -------\n        The value returned by `func`.\n\n        \"\"\"\n        with warnings.catch_warnings(record=True) as l:\n            warnings.simplefilter('always')\n            result = func(*args, **kw)\n            if not len(l) > 0:\n                raise AssertionError(\"No warning raised when calling %s\"\n                        % func.__name__)\n            if not l[0].category is warning_class:\n                raise AssertionError(\"First warning for %s is not a \"\n                        \"%s( is %s)\" % (func.__name__, warning_class, l[0]))\n        return result\n", "path": "scipy/_lib/_numpy_compat.py"}]}