Added a warning when constructing a Matrix without bracket + test modified
[sympy.git] / bin / adapt_paths.py
blobc021a5fd781475617f9d6cdad7ae00711dbdd457
1 """
2 This script adapts import statements in sympy/mpmath/tests to work properly.
4 We want to have this fully automatic, so that we don't have to do it by hand
5 each time we copy files from mpmath to sympy.
7 Usage:
9 $ python bin/adapt_paths.py > /tmp/x
10 $ patch -p0 < /tmp/x
12 You can use the "--dry-run" parameter to 'patch' to see if all is ok and you
13 should also inspect the /tmp/x that all the changes generated are actually
14 correct.
15 """
17 from glob import glob
18 import re
19 import difflib
21 def get_files_mpmath():
22 return glob("sympy/mpmath/tests/test_*.py")
24 def fix_file(filename):
25 f = open(filename)
26 orig = f.read()
27 # This converts stuff like "mpmath.dps -> sympy.mpmath.dps", but will leave
28 # "sympy.mpmath.dps" untouched.
29 s = re.sub("(?<!sympy\.)mpmath", "sympy.mpmath", orig)
31 # print differences in an unified diff format
32 d = difflib.unified_diff(orig.split("\n"), s.split("\n"),
33 fromfile=filename, tofile=filename+".new", lineterm="")
34 import sys
35 for l in d:
36 print l
39 for x in get_files_mpmath():
40 fix_file(x)