details:   http://hg.sympy.org/sympy/rev/6128bd120595
changeset: 1826:6128bd120595
user:      Andy R. Terrel <[EMAIL PROTECTED]>
date:      Sun Oct 19 21:28:48 2008 +0200
description:
Implement comments from review.

diffs (83 lines):

diff -r 96f514a7fe9f -r 6128bd120595 sympy/functions/elementary/piecewise.py
--- a/sympy/functions/elementary/piecewise.py   Sun Oct 19 21:28:48 2008 +0200
+++ b/sympy/functions/elementary/piecewise.py   Sun Oct 19 21:28:48 2008 +0200
@@ -1,6 +1,5 @@
 
 from sympy.core.basic import Basic, S
-from sympy.core.cache import cacheit
 from sympy.core.function import Function, FunctionClass, diff
 from sympy.core.numbers import Number
 from sympy.core.relational import Relational
@@ -36,7 +35,6 @@
 
     nargs=None
 
-    @cacheit
     def __new__(cls, *args, **options):
         for opt in ["nargs", "dummy", "comparable", "noncommutative", 
"commutative"]:
             if opt in options:
@@ -171,6 +169,7 @@
                               ", ".join([str((h[0],h[1])) for h in holes])
 
         # Finally run through the intervals and sum the evaluation.
+        # TODO: Either refactor this code or Integral.doit to call 
_eval_interval
         ret_fun = 0
         for int_a, int_b, expr in int_expr:
             B = expr.subs(sym, min(b,int_b))
@@ -207,8 +206,11 @@
 
     @classmethod
     def __eval_cond(cls, cond):
-        """Returns if the condition is True or False.
-           If it is undeterminable, returns None."""
+        """
+        Returns if the condition is True or False.
+
+        If it is undeterminable, returns None.
+        """
         if type(cond) == bool:
             return cond
         arg0 = cond.args[0]
diff -r 96f514a7fe9f -r 6128bd120595 
sympy/functions/elementary/tests/test_piecewise.py
--- a/sympy/functions/elementary/tests/test_piecewise.py        Sun Oct 19 
21:28:48 2008 +0200
+++ b/sympy/functions/elementary/tests/test_piecewise.py        Sun Oct 19 
21:28:48 2008 +0200
@@ -1,4 +1,4 @@
-from sympy import diff, Integral, integrate, log, oo, Piecewise, symbols
+from sympy import diff, Integral, integrate, log, oo, Piecewise, raises, 
symbols
 
 x,y = symbols('xy')
 
@@ -8,20 +8,8 @@
     assert Piecewise((x, x < 1), (0, True)) == Piecewise((x, x < 1), (0, True))
     assert Piecewise((x, x < 1), (0, False), (-1, 1>2)) == Piecewise((x, x < 
1))
     assert Piecewise((x, True)) == x
-
-    exception_called = False
-    try:
-        Piecewise(x)
-    except TypeError:
-        exception_called = True
-    assert exception_called
-
-    exception_called = False
-    try:
-        Piecewise((x,x**2))
-    except TypeError:
-        exception_called = True
-    assert exception_called
+    raises(TypeError,"Piecewise(x)")
+    raises(TypeError,"Piecewise((x,x**2))")
 
     # Test subs
     p = Piecewise((-1, x < -1), (x**2, x < 0), (log(x), x >=0))
@@ -76,9 +64,4 @@
     p = Piecewise((0, x < 0), (1,x < 1), (0, x < 2), (1, x < 3), (0, True))
     assert integrate(p, (x,-oo,oo)) == 2
     p = Piecewise((x, x < -10),(x**2, x <= -1),(x, 1 < x))
-    exception_called = False
-    try:
-        integrate(p,(x,-2,2))
-    except ValueError:
-        exception_called = True
-    assert exception_called
+    raises(ValueError, "integrate(p,(x,-2,2))")

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy-commits" group.
To post to this group, send email to sympy-commits@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sympy-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to