Skip to content

Commit

Permalink
Allow tests to pass using Python 3
Browse files Browse the repository at this point in the history
These tests failed on Python 3 only because they used Python 2-specific syntax.
  • Loading branch information
sethaxen committed Jun 23, 2018
1 parent 4c281af commit 31313b3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pyext/src/io/xltable.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def save_maps(self,maps_fn):
maxlen=max(len(self.index_dict[key]) for key in self.index_dict)
cnames=[]
idxs=[]
for cname,idx in self.index_dict.iteritems():
for cname,idx in self.index_dict.items():
cnames.append(cname)
idxs.append(idx+[-1]*(maxlen-len(idx)))
idx_array=np.array(idxs)
Expand Down Expand Up @@ -851,7 +851,7 @@ def plot_table(self, prot_listx=None,

# display and write to file
fig.set_size_inches(0.002 * nresx, 0.002 * nresy)
[i.set_linewidth(2.0) for i in ax.spines.itervalues()]
[i.set_linewidth(2.0) for i in ax.spines.values()]
if cbar_labels is not None:
cbar = fig.colorbar(cax, ticks=[0.5,1.5,2.5,3.5])
cbar.ax.set_yticklabels(cbar_labels)# vertically oriented colorbar
Expand Down
8 changes: 5 additions & 3 deletions test/expensive_test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_get_best_models(self):
self.assertEqual(len(rmf_file_list),8)
self.assertEqual(len(rmf_file_frame_list),8)
self.assertEqual(len(score_list),8)
for k,l in feature_keyword_list_dict.iteritems():
for k,l in feature_keyword_list_dict.items():
self.assertEqual(len(l),8)

def test_read_coordinates_of_rmfs(self):
Expand Down Expand Up @@ -86,8 +86,10 @@ def test_read_coordinates_of_rmfs(self):
self.assertEqual(len(all_coordinates),8)
self.assertEqual(len(alignment_coordinates),8)
self.assertEqual(len(rmsd_coordinates),8)
self.assertEqual(rmsd_coordinates[0].keys(),['med2'])
self.assertEqual(cmp(alignment_coordinates,[{}]*8),0)
self.assertEqual(list(rmsd_coordinates[0].keys()), ['med2'])
ltmp = [{}] * 8
self.assertEqual((alignment_coordinates > ltmp) -
(alignment_coordinates < ltmp), 0)

# testing first coordinate of med2 for each frame
check_coords=[[17.23349762, 27.99548721,-8.91260719],
Expand Down
4 changes: 2 additions & 2 deletions test/expensive_test_replica_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def test_macro(self):
rmf_file_index])
nframes=len(d[mc_nframe_key])
self.assertNotEqual(float(d[mc_nframe_key][-1]), 0)
self.assertEqual(map(float,d[mc_temp_key]), [1.0]*nframes)
self.assertEqual(list(map(float,d[mc_temp_key])), [1.0]*nframes)
self.assertGreater(float(d[rex_min_temp_key][-1]), 0.0)
# always fails
#self.assertGreater(float(d[rex_max_temp_key][-1]), 0.0)
Expand Down Expand Up @@ -283,7 +283,7 @@ def test_macro_rmf_stat(self):
rmf_file_index])
nframes=len(d[mc_nframe_key])
self.assertNotEqual(float(d[mc_nframe_key][-1]), 0)
self.assertEqual(map(float,d[mc_temp_key]), [1.0]*nframes)
self.assertEqual(list(map(float,d[mc_temp_key])), [1.0]*nframes)
self.assertGreater(float(d[rex_min_temp_key][-1]), 0.0)
# always fails
#self.assertGreater(float(d[rex_max_temp_key][-1]), 0.0)
Expand Down

0 comments on commit 31313b3

Please sign in to comment.