Skip to content

Commit

Permalink
ENH: support python 3
Browse files Browse the repository at this point in the history
* closes #56
* running `2to3 rdtools/` shows the only incompatibilities are the
 relative imports already addressed in #67 so merge #68 to fix imports
* running `2to3 tests/` shows python 2 print commands, so rerun 2to3
with `-f print -w -n` to add parentheses to print statements to make
them calls instead of commands, altho these should really be replaced
by logging, so TODO: make another issue and PR to add logging to tests

Signed-off-by: Mark Mikofski <bwana.marko@yahoo.com>
  • Loading branch information
mikofski committed Feb 24, 2018
1 parent a5dbc1f commit 868f70a
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/degradation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,43 +108,43 @@ def test_degradation_with_ols(cls):
''' Test degradation with ols. '''

funcName = sys._getframe().f_code.co_name
print '\r', 'Running ', funcName
print('\r', 'Running ', funcName)

# test ols degradation calc
for input_freq in cls.list_ols_input_freq:
print 'Frequency: ', input_freq
print('Frequency: ', input_freq)
rd_result = degradation_ols(cls.test_corr_energy[input_freq])
cls.assertAlmostEqual(rd_result[0], 100 * cls.rd, places=1)
print 'Actual: ', 100 * cls.rd
print 'Estimated: ', rd_result[0]
print('Actual: ', 100 * cls.rd)
print('Estimated: ', rd_result[0])

def test_degradation_classical_decomposition(cls):
''' Test degradation with classical decomposition. '''

funcName = sys._getframe().f_code.co_name
print '\r', 'Running ', funcName
print('\r', 'Running ', funcName)

# test classical decomposition degradation calc
for input_freq in cls.list_CD_input_freq:
print 'Frequency: ', input_freq
print('Frequency: ', input_freq)
rd_result = degradation_classical_decomposition(cls.test_corr_energy[input_freq])
cls.assertAlmostEqual(rd_result[0], 100 * cls.rd, places=1)
print 'Actual: ', 100 * cls.rd
print 'Estimated: ', rd_result[0]
print('Actual: ', 100 * cls.rd)
print('Estimated: ', rd_result[0])

def test_degradation_year_on_year(cls):
''' Test degradation with year on year approach. '''

funcName = sys._getframe().f_code.co_name
print '\r', 'Running ', funcName
print('\r', 'Running ', funcName)

# test YOY degradation calc
for input_freq in cls.list_YOY_input_freq:
print 'Frequency: ', input_freq
print('Frequency: ', input_freq)
rd_result = degradation_year_on_year(cls.test_corr_energy[input_freq])
cls.assertAlmostEqual(rd_result[0], 100 * cls.rd, places=1)
print 'Actual: ', 100 * cls.rd
print 'Estimated: ', rd_result[0]
print('Actual: ', 100 * cls.rd)
print('Estimated: ', rd_result[0])

if __name__ == '__main__':
unittest.main()

0 comments on commit 868f70a

Please sign in to comment.