def test_interval_indexer_1b(self): # BWV7.7: first 26 things in soprano part (no settings specified) test_parts = pandas.concat([self.bwv77_soprano], axis=1) test_parts.columns = pandas.MultiIndex.from_product([('A', ), ('0', )]) expected = TestHorizIntervalIndexerLong.bwv77_S_B_short_noqual['a'] actual = HorizontalIntervalIndexer(test_parts).run().iloc[:26, 0] self.assertTrue(actual.equals(expected))
def test_interval_indexer_2(self): # BWV7.7: whole soprano part # NB: this test is more rigourous than the others, since it actually uses the DataFrame test_parts = pandas.concat([self.bwv77_soprano], axis=1) test_parts.columns = pandas.MultiIndex.from_product([('A', ), ('0', )]) expected = TestHorizIntervalIndexerLong.bwv77_S_B_basis['a'] setts = {'simple or compound': 'compound', 'quality': True} actual = HorizontalIntervalIndexer(test_parts, setts).run().iloc[:, 0] self.assertTrue(actual.equals(expected))
def test_interval_indexer_1c(self): # BWV7.7: first 26 things in soprano part (simple; no quality) test_parts = pandas.concat([self.bwv77_soprano], axis=1) test_parts.columns = pandas.MultiIndex.from_product([('A', ), ('0', )]) expected = TestHorizIntervalIndexerLong.bwv77_S_B_short_noqual['a'] setts = {'simple or compound': 'simple', 'quality': False} actual = HorizontalIntervalIndexer(test_parts, setts).run().iloc[:26, 0] self.assertTrue(actual.equals(expected))
def test_interval_indexer_3(self): """BWV7.7: whole bass part; 'horiz_attach_later' is True""" test_parts = pandas.concat([self.bwv77_bass], axis=1) test_parts.columns = pandas.MultiIndex.from_product([('A', ), ('0', )]) setts = { 'simple or compound': 'compound', 'quality': True, 'horiz_attach_later': True } expected = pandas.read_pickle( os.path.join(VIS_PATH, 'tests', 'corpus', 'data_horiz_int_ind_3.pickle')) actual = HorizontalIntervalIndexer(test_parts, setts).run() self.assertTrue(actual.equals(expected))