Melopy icon indicating copy to clipboard operation
Melopy copied to clipboard

Fix tests, imports and readme

Open frankharkins opened this issue 3 years ago • 2 comments

Change 1 (fix imports)

On trying to import:

from melopy.scales import generateScale

I got this error:

In [1]: from melopy.scales import generateScale
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-8766c174d199> in <module>
----> 1 from melopy.scales import generateScale

~/.local/lib/python3.8/site-packages/melopy/scales.py in <module>
      5 class MelopyValueError(ValueError): pass
      6 
----> 7 from utility import note_to_key, key_to_note
      8 
      9 def bReturn(output, Type):

ModuleNotFoundError: No module named 'utility'

Which was fixed by adding 'melopy.' to the start of each melopy import.

Change 2 (fix tests)

The tests were still failing, I think this is because key_to_note was expecting integer division with /. I have changed this to // and the tests pass (and the results make sense). Additionally, had to move tests/melopy_tests.py to top level (called it tests.py).

Change 3 (fix readme)

Fixes #63

Change 4

Added __future__ statements to make compatible with Python 2.

Thanks.

frankharkins avatar Apr 12 '21 20:04 frankharkins

I think what you are seeing is due to the fact that this was originally designed to work with python 2, not python 3. I don't think that it would be wise to make changes that break python 2 support.

asteriskman7 avatar Apr 12 '21 21:04 asteriskman7

Python 2 was sunset a while ago, although I think a simple __future__ import might let this work with both. Let me try tonight.

frankharkins avatar Apr 13 '21 08:04 frankharkins