From 65ddbe067630a7fbca093886bbf364833742594e Mon Sep 17 00:00:00 2001
From: Martin Bauer <martin.bauer@fau.de>
Date: Tue, 2 Oct 2018 15:26:15 +0200
Subject: [PATCH] Fixes for printing problem e.g. f_N vs f[0,1]

- if a field access is printed in compass or index notation seems to
  depend on the sympy version
- removed doctests that rely on the printed form
---
 field.py            | 6 +-----
 kernel_decorator.py | 4 ++--
 stencils.py         | 3 +--
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/field.py b/field.py
index e1e4401..3e6486e 100644
--- a/field.py
+++ b/field.py
@@ -153,11 +153,7 @@ class Field:
         >>> from pystencils import Assignment
         >>> stencil = np.array([[0,0], [0,1], [0,-1]])
         >>> src, dst = fields("src(3), dst(3) : double[2D]")
-        >>> for i, offset in enumerate(stencil):
-        ...     Assignment(dst[0,0](i), src[-offset](i))
-        Assignment(dst_C^0, src_C^0)
-        Assignment(dst_C^1, src_S^1)
-        Assignment(dst_C^2, src_N^2)
+        >>> assignments = [Assignment(dst[0,0](i), src[-offset](i)) for i, offset in enumerate(stencil)];
     """
 
     @staticmethod
diff --git a/kernel_decorator.py b/kernel_decorator.py
index e895ad8..0063865 100644
--- a/kernel_decorator.py
+++ b/kernel_decorator.py
@@ -25,8 +25,8 @@ def kernel(func, **kwargs):
         ...     f, g = ps.fields('f, g: [2D]')
         ...     s.neighbors @= f[0,1] + f[1,0]
         ...     g[0,0]      @= s.neighbors + f[0,0] if f[0,0] > 0 else 0
-        >>> my_kernel
-        [Assignment(neighbors, f_N + f_E), Assignment(g_C, Piecewise((f_C + neighbors, f_C > 0), (0, True)))]
+        >>> f, g = ps.fields('f, g: [2D]')
+        >>> assert my_kernel[0].rhs == f[0,1] + f[1,0]
     """
     source = inspect.getsource(func)
     source = textwrap.dedent(source)
diff --git a/stencils.py b/stencils.py
index d304cb5..2cd5f02 100644
--- a/stencils.py
+++ b/stencils.py
@@ -90,8 +90,7 @@ def stencil_coefficients(expr):
 
     >>> import pystencils as ps
     >>> f = ps.fields("f(3) : double[2D]")
-    >>> stencil_coefficients(2 * f[0, 1](1) + 3 * f[-1, 0](1))
-    ([(-1, 0), (0, 1)], [3, 2])
+    >>> coff = stencil_coefficients(2 * f[0, 1](1) + 3 * f[-1, 0](1))
     """
     field_center, coefficients, nonlinear_part = stencil_coefficient_dict(expr)
     assert nonlinear_part == 0
-- 
GitLab