csdms / bmi-example-python

An example of wrapping a model written in Python with a BMI
https://bmi.csdms.io
MIT License
13 stars 22 forks source link

Python 2 and 3 compatible #6

Closed benvanwerkhoven closed 6 years ago

benvanwerkhoven commented 6 years ago

A doctest fails because of the following:

$ nosetests --with-doctest --with-coverage --cover-package=heat
.F..............................
======================================================================
FAIL: Doctest: heat.heat.solve_2d
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/miniconda/envs/test-env/lib/python2.7/doctest.py", line 2226, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for heat.heat.solve_2d
  File "/home/travis/build/csdms/bmi-python/heat/heat.py", line 8, in solve_2d
----------------------------------------------------------------------
File "/home/travis/build/csdms/bmi-python/heat/heat.py", line 34, in heat.heat.solve_2d
Failed example:
    solve_2d(z0, (1., 1.), alpha=.125)
Expected:
    array([[ 0. ,  0. ,  0. ],
           [ 0. ,  0.5,  0. ],
           [ 0. ,  0. ,  0. ]])
Got:
    array([[0. , 0. , 0. ],
           [0. , 0.5, 0. ],
           [0. , 0. , 0. ]])

The only difference seems to be the spacing in how the array is printed. I will try to fix that and hopefully the tests will pass for both Python 2 and 3.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 241218f234048dfa44deca146cec1f9d33e8c51d on eWaterCycle:master into 730a1fdafc2d8d87c085770d511776d80005f8f2 on csdms:master.

mdpiper commented 6 years ago

Thanks, @benvanwerkhoven!