From 2b9ba8feb60c6166204c6ea703d5c74702c37068 Mon Sep 17 00:00:00 2001 From: Alexander Morgan Date: Sun, 11 Sep 2016 19:17:18 -0400 Subject: [PATCH] WIP: fix dissonance tests, still not there yet. --- vis/models/indexed_piece.py | 6 +++--- vis/tests/test_dissonance_indexer.py | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/vis/models/indexed_piece.py b/vis/models/indexed_piece.py index e60cdb22..f8ca3159 100755 --- a/vis/models/indexed_piece.py +++ b/vis/models/indexed_piece.py @@ -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 diff --git a/vis/tests/test_dissonance_indexer.py b/vis/tests/test_dissonance_indexer.py index e0c81e04..958f0cdd 100755 --- a/vis/tests/test_dissonance_indexer.py +++ b/vis/tests/test_dissonance_indexer.py @@ -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)) #-------------------------------------------------------------------------------------------------#