Skip to content

Commit

Permalink
[Test] Fix deprecation warnings in Python tests
Browse files Browse the repository at this point in the history
This also fixes support for Numpy 1.10, which removes the 'skiprows' keyword.
  • Loading branch information
speth committed Oct 7, 2015
1 parent 92d3ba0 commit 5811035
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions interfaces/cython/cantera/ck2cti.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,17 @@
def strip_nonascii(s):
return s.decode('ascii', 'ignore')

def open(filename, *args):
return _open(filename, *args)
def open(filename, mode, *args):
return _open(filename, mode, *args)

else:
string_types = (str,)
def strip_nonascii(s):
return s.encode('ascii', 'ignore').decode()

def open(filename, *args):
return _open(filename, *args, errors='ignore')
def open(filename, mode, *args):
mode = mode.replace('U', '')
return _open(filename, mode, *args, errors='ignore')


def compatible_quantities(quantity_basis, units):
Expand Down
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/test/test_onedim.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def test_write_csv(self):

self.create_sim(2e5, 350, 'H2:1.0, O2:2.0', mech='h2o2.xml')
self.sim.write_csv(filename)
data = np.genfromtxt(filename, delimiter=',', skiprows=1)
data = np.genfromtxt(filename, delimiter=',', skip_header=1)
self.assertArrayNear(data[:,0], self.sim.grid)
self.assertArrayNear(data[:,3], self.sim.T)
k = self.gas.species_index('H2')
Expand Down

0 comments on commit 5811035

Please sign in to comment.