Permalink
Browse files

Merge pull request #1517 from jrioux/tests

Failing python 3 pretty printing tests
  • Loading branch information...
2 parents cf6bb17 + 5c672d9 commit c49dca1e4412ea44441e09772ba2d07a2a9f92f0 @asmeurer asmeurer committed Sep 12, 2012
View
@@ -64,6 +64,9 @@ relevant_rst_files.append(np('./doc/src/python-comparisons.rst'))
relevant_no_extension = ('bin/doctest', 'bin/isympy', 'bin/test',
'bin/test_import', 'bin/test_isolated')
+# Keep a record of destination files, used to remove any lingering files.
+dst_files = set()
+
# ask git for a list of tracked files
try:
files = check_output(['git', 'ls-files'])
@@ -76,6 +79,7 @@ try:
for filename in filenames:
src = filename
dst = os.path.normpath(os.path.join(destination, filename))
+ dst_files.add(dst)
dstdir = os.path.split(dst)[0]
if "mpmath" in dstdir:
@@ -126,8 +130,10 @@ args_2to3_doctests.extend(modified_rst_files)
# call 2to3, once for regular files and once for doctests
from lib2to3.main import main as main2to3
-main2to3("lib2to3.fixes", args_2to3)
-main2to3("lib2to3.fixes", args_2to3_doctests)
+if modified_files:
+ main2to3("lib2to3.fixes", args_2to3)
+if modified_files or modified_rst_files:
+ main2to3("lib2to3.fixes", args_2to3_doctests)
# remove trailing spaced added to lines by 2to3
whitespace = re.compile(" +$", re.MULTILINE)
@@ -150,6 +156,16 @@ for filepath in modified_files + modified_rst_files:
with open(filepath, 'w') as f:
f.write(text)
+# Remove files that no longer exist
+for root, dirs, files in os.walk(destination):
+ if "mpmath" in root:
+ continue
+ for file in files:
+ filepath = os.path.normpath(os.path.join(root, file))
+ if filepath not in dst_files:
+ sys.stdout.write("Removing lingering file %s\n" % filepath)
+ os.remove(filepath)
+
# once we are finished with everything, we should finally copy over the files
# provided by mpmath; these should all be in the following two directories
@@ -16,6 +16,7 @@ class Partition(C.FiniteSet):
See Also
========
+
sympy.utilities.iterables.partitions,
sympy.utilities.iterables.multiset_partitions
"""
@@ -32,6 +33,7 @@ def __new__(cls, partition):
Examples
========
+
>>> from sympy.combinatorics.partitions import Partition
>>> a = Partition([[1, 2], [3]])
>>> a
@@ -66,6 +68,7 @@ def sort_key(self, order=None):
Examples
========
+
>>> from sympy.utilities.iterables import default_sort_key
>>> from sympy.combinatorics.partitions import Partition
>>> from sympy.abc import x
@@ -90,6 +93,7 @@ def partition(self):
Examples
========
+
>>> from sympy.combinatorics.partitions import Partition
>>> Partition([[1], [2, 3]]).partition
[[1], [2, 3]]
@@ -105,6 +109,7 @@ def __add__(self, other):
Examples
========
+
>>> from sympy.combinatorics.partitions import Partition
>>> a = Partition([[1, 2], [3]])
>>> a.rank
@@ -128,6 +133,7 @@ def __sub__(self, other):
Examples
========
+
>>> from sympy.combinatorics.partitions import Partition
>>> a = Partition([[1, 2], [3]])
>>> a.rank
@@ -146,6 +152,7 @@ def __le__(self, other):
Examples
========
+
>>> from sympy.combinatorics.partitions import Partition
>>> a = Partition([[1, 2], [3, 4, 5]])
>>> b = Partition([[1], [2, 3], [4], [5]])
@@ -164,6 +171,7 @@ def __lt__(self, other):
Examples
========
+
>>> from sympy.combinatorics.partitions import Partition
>>> a = Partition([[1, 2], [3, 4, 5]])
>>> b = Partition([[1], [2, 3], [4], [5]])
@@ -181,6 +189,7 @@ def rank(self):
Examples
========
+
>>> from sympy.combinatorics.partitions import Partition
>>> a = Partition([[1, 2], [3], [4, 5]])
>>> a.rank
@@ -203,6 +212,7 @@ def RGS(self):
Examples
========
+
>>> from sympy.combinatorics.partitions import Partition
>>> a = Partition([[1, 2], [3], [4, 5]])
>>> a.members
@@ -234,6 +244,7 @@ def from_rgs(self, rgs, elements):
Examples
========
+
>>> from sympy.combinatorics.partitions import Partition
>>> Partition.from_rgs([0, 1, 2, 0, 1], list('abcde'))
{{c}, {a, d}, {b, e}}
@@ -270,6 +281,7 @@ class IntegerPartition(Basic):
See Also
========
+
sympy.utilities.iterables.partitions,
sympy.utilities.iterables.multiset_partitions
@@ -290,6 +302,7 @@ def __new__(cls, partition, integer=None):
Examples
========
+
>>> from sympy.combinatorics.partitions import IntegerPartition
>>> a = IntegerPartition([5, 4, 3, 1, 1])
>>> a
@@ -344,6 +357,7 @@ def prev_lex(self):
Examples
========
+
>>> from sympy.combinatorics.partitions import IntegerPartition
>>> p = IntegerPartition([4])
>>> print p.prev_lex()
@@ -380,6 +394,7 @@ def next_lex(self):
Examples
========
+
>>> from sympy.combinatorics.partitions import IntegerPartition
>>> p = IntegerPartition([3, 1])
>>> print p.next_lex()
@@ -430,6 +445,7 @@ def as_dict(self):
Examples
========
+
>>> from sympy.combinatorics.partitions import IntegerPartition
>>> IntegerPartition([1]*3 + [2] + [3]*4).as_dict()
{1: 3, 2: 1, 3: 4}
@@ -452,8 +468,8 @@ def conjugate(self):
Examples
========
- >>> from sympy.combinatorics.partitions import \
- IntegerPartition
+
+ >>> from sympy.combinatorics.partitions import IntegerPartition
>>> a = IntegerPartition([6, 3, 3, 2, 1])
>>> a.conjugate
[5, 4, 3, 1, 1, 1]
@@ -475,6 +491,7 @@ def __lt__(self, other):
Examples
========
+
>>> from sympy.combinatorics.partitions import IntegerPartition
>>> a = IntegerPartition([3, 1])
>>> a < a
@@ -493,6 +510,7 @@ def __le__(self, other):
Examples
========
+
>>> from sympy.combinatorics.partitions import IntegerPartition
>>> a = IntegerPartition([4])
>>> a <= a
@@ -506,6 +524,7 @@ def as_ferrers(self, char='#'):
Examples
========
+
>>> from sympy.combinatorics.partitions import IntegerPartition
>>> print IntegerPartition([1, 1, 5]).as_ferrers()
#####
@@ -524,6 +543,7 @@ def random_integer_partition(n, seed=None):
Examples
========
+
>>> from sympy.combinatorics.partitions import random_integer_partition
For the following, a seed is given so a known value can be shown; in
@@ -561,8 +581,8 @@ def RGS_generalized(m):
Examples
========
- >>> from sympy.combinatorics.partitions import \
- RGS_generalized
+
+ >>> from sympy.combinatorics.partitions import RGS_generalized
>>> RGS_generalized(6)
[ 1, 1, 1, 1, 1, 1, 1]
[ 1, 2, 3, 4, 5, 6, 0]
@@ -592,6 +612,7 @@ def RGS_enum(m):
Examples
========
+
>>> from sympy.combinatorics.partitions import RGS_enum
>>> from sympy.combinatorics.partitions import Partition
>>> RGS_enum(4)
@@ -633,6 +654,7 @@ def RGS_unrank(rank, m):
Examples
========
+
>>> from sympy.combinatorics.partitions import RGS_unrank
>>> RGS_unrank(14, 4)
[0, 1, 2, 3]
@@ -665,6 +687,7 @@ def RGS_rank(rgs):
Examples
========
+
>>> from sympy.combinatorics.partitions import RGS_rank, RGS_unrank
>>> RGS_rank([0, 1, 2, 1, 3])
42
Oops, something went wrong.

0 comments on commit c49dca1

Please sign in to comment.