Skip to content

Commit

Permalink
WIP: fix dissonance tests, still not there yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermorgan committed Sep 11, 2016
1 parent 64d40b4 commit 2b9ba8f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions vis/models/indexed_piece.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,9 @@ def _get_duration(self):
def _get_beat_strength(self):
"""Used internally by get_data() to cache and retrieve results from the
meter.NoteBeatStrengthIndexer."""
if 'beatstrength' not in self._analyses:
self._analyses['beatstrength'] = meter.NoteBeatStrengthIndexer(self._get_m21_nrc_objs_no_tied()).run()
return self._analyses['beatstrength']
if 'beat_strength' not in self._analyses:
self._analyses['beat_strength'] = meter.NoteBeatStrengthIndexer(self._get_m21_nrc_objs_no_tied()).run()
return self._analyses['beat_strength']

def _get_fermata(self):
"""Used internally by get_data() to cache and retrieve results from the
Expand Down
8 changes: 6 additions & 2 deletions vis/tests/test_dissonance_indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,13 @@ def test_diss_indexer_run_2(self):
this test should get moved to the integration tests file.
"""
expected = pd.read_pickle(os.path.join(VIS_PATH, 'tests', 'expecteds', 'test_dissonance_thorough.pickle'))
ip = IndexedPiece(os.path.join(VIS_PATH, 'tests', 'corpus', 'Kyrie.krn'))
ip = IndexedPiece('dummy_path')
ip._analyses['beat_strength'] = pd.read_pickle('/home/amor/Code/vis-framework/vis/tests/expecteds/test_dissonance_indf_bs.pickle')
ip._analyses['duration'] = pd.read_pickle('/home/amor/Code/vis-framework/vis/tests/expecteds/test_dissonance_indf_du.pickle')
ip._analyses['horizontal_interval'] = pd.read_pickle('/home/amor/Code/vis-framework/vis/tests/expecteds/test_dissonance_indf_hz.pickle')
ip._analyses['vertical_interval'] = pd.read_pickle('/home/amor/Code/vis-framework/vis/tests/expecteds/test_dissonance_indf_vt.pickle')
actual = ip._get_dissonance()
assert_frame_equal(expected, actual)
self.assertTrue(actual.equals(expected))


#-------------------------------------------------------------------------------------------------#
Expand Down

0 comments on commit 2b9ba8f

Please sign in to comment.