Skip to content

Commit

Permalink
Add test to reproduce linewrap error
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverlee committed Oct 21, 2015
1 parent 8ff727d commit 12ef6f8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pydy/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
from setuptools import __version__ as SETUPTOOLS_VERSION
from nose.tools import assert_raises

from sympy import cos, sin, tan, sqrt, Matrix
from sympy.physics.mechanics import dynamicsymbols

from ..utils import sympy_equal_to_or_newer_than
from ..codegen.cython_code import CythonMatrixGenerator


def test_sympy_equal_to_or_newer_than():
Expand All @@ -18,3 +22,17 @@ def test_sympy_equal_to_or_newer_than():
if parse_version(SETUPTOOLS_VERSION) >= parse_version('8.0'):
with assert_raises(ValueError):
sympy_equal_to_or_newer_than('0.7.7', '0.7.6-git')

def test_codegen_linewrap():

# Generated can result in long expressions with no obvious place to insert a
# newline. Refer to https://github.com/pydy/pydy/issues/263.
x, y, z = dynamicsymbols('x y z')
expr = (x*y*z*cos(x)*sin(x)*tan(x)*sqrt(x)*cos(y)*sin(y)*tan(y)*
sqrt(y)*cos(z)*sin(z)*tan(z)*sqrt(z)*cos(x*y)*sin(x*y)*tan(x*y)*
sqrt(x*y)* cos(y*z)*sin(y*z)*tan(y*z)*sqrt(y*z)*cos(z*x)*
sin(z*x)*tan(z*x)*sqrt(z*x)*3)/8
mat_expr = Matrix([expr])

q = [x, y, z]
gen = CythonMatrixGenerator([q], [mat_expr])

0 comments on commit 12ef6f8

Please sign in to comment.