def test_interval_ngrams_2(self, mock_two, mock_all, mock_var, mock_rfa):
     # --> same as test_interval_ngrams_1(), but with "count frequency" set to False
     # 1.) prepare mocks
     ind_pieces = [MagicMock(spec=IndexedPiece) for _ in xrange(3)]
     mock_rfa.return_value = u'mock_rfa() return value'
     mock_two.return_value = [u'mock_two() return value']
     mock_all.return_value = [u'mock_all() return value']
     mock_var.return_value = [u'mock_var() return value']
     expected = [mock_all.return_value, mock_two.return_value, mock_var.return_value]
     # 2.) run the test
     test_wm = WorkflowManager(ind_pieces)
     test_wm.settings(0, u'voice combinations', u'all')
     test_wm.settings(1, u'voice combinations', u'all pairs')
     test_wm.settings(2, u'voice combinations', u'[[0, 1]]')
     test_wm.settings(None, 'count frequency', False)
     actual = test_wm._interval_ngrams()
     # 3.) verify the mocks
     # NB: in actual use, _run_freq_agg() would have the final say on the value of
     #     test_wm._result... but it's mocked out, which means we can test whether
     #     _interval_ngrams() puts the right stuff there
     self.assertEqual(3, len(test_wm._result))
     for ret_val in expected:
         self.assertTrue(ret_val in test_wm._result)
     mock_two.assert_called_once_with(1)
     mock_all.assert_called_once_with(0)
     mock_var.assert_called_once_with(2)
     self.assertEqual(0, mock_rfa.call_count)
     self.assertEqual(expected, actual)
     self.assertSequenceEqual(expected, test_wm._result)
 def test_interval_ngrams_1(self, mock_two, mock_all, mock_var, mock_rfa):
     # --> test with three pieces, each of which requires a different helper
     # 1.) prepare mocks
     ind_pieces = [MagicMock(spec=IndexedPiece) for _ in xrange(3)]
     mock_rfa.return_value = u'mock_rfa() return value'
     mock_two.return_value = [u'mock_two() return value']
     mock_all.return_value = [u'mock_all() return value']
     mock_var.return_value = [u'mock_var() return value']
     expected = [mock_all.return_value, mock_two.return_value, mock_var.return_value]
     # 2.) run the test
     test_wm = WorkflowManager(ind_pieces)
     test_wm.settings(0, u'voice combinations', u'all')
     test_wm.settings(1, u'voice combinations', u'all pairs')
     test_wm.settings(2, u'voice combinations', u'[[0, 1]]')
     actual = test_wm._interval_ngrams()
     # 3.) verify the mocks
     # NB: in actual use, _run_freq_agg() would have the final say on the value of
     #     test_wm._result... but it's mocked out, which means we can test whether
     #     _interval_ngrams() puts the right stuff there
     mock_two.assert_called_once_with(1)
     mock_all.assert_called_once_with(0)
     mock_var.assert_called_once_with(2)
     mock_rfa.assert_called_once_with()
     self.assertSequenceEqual(expected, actual)
     self.assertSequenceEqual(expected, test_wm._result)