Exemplo n.º 1
0
 def test_init5(self):
     """tests that __init__() fails when the given voice doesn't exist"""
     settings = {'length': 2, 'voice': 15}
     self.assertRaises(RuntimeError, approach.ApproachIndexer, lyst,
                       settings)
     try:
         approach.ApproachIndexer(lyst, settings)
     except RuntimeError as run_err:
         self.assertEqual(approach.ApproachIndexer._BAD_VOICE,
                          run_err.args[0])
Exemplo n.º 2
0
 def test_init4(self):
     """tests that __init__() fails when the given length is too low"""
     settings = {'length': 0.3}
     self.assertRaises(RuntimeError, approach.ApproachIndexer, lyst,
                       settings)
     try:
         approach.ApproachIndexer(lyst, settings)
     except RuntimeError as run_err:
         self.assertEqual(approach.ApproachIndexer._LOW_LENGTH,
                          run_err.args[0])
Exemplo n.º 3
0
 def test_init3(self):
     """tests that __init__() fails when length is not given"""
     settings = {}
     self.assertRaises(RuntimeError, approach.ApproachIndexer, lyst,
                       settings)
     try:
         approach.ApproachIndexer(lyst, settings)
     except RuntimeError as run_err:
         self.assertEqual(approach.ApproachIndexer._MISSING_LENGTH,
                          run_err.args[0])
Exemplo n.º 4
0
 def _get_approach(self, data=[], settings=None):
     """Used internally by get() as a convenience method to simplify getting results from
     the ApproachIndexer. Since the results of the ExpressionIndexer are required for this and do not
     take any settings, they are automatically provided for the user, so only the results of the
     OverBassIndexer must necessarily be provided in the 'data' argument."""
     if len(
             data
     ) == 1:  # If data has more than two dfs, or the wrong dfs, this will be caught later
         temp = [self._get_expression()]
         temp.extend(data)
         data = temp
     return approach.ApproachIndexer(data, settings).run()
Exemplo n.º 5
0
 def test_init1(self):
     """tests that __init__() works with only the basic settings given"""
     actual = approach.ApproachIndexer(lyst, {'length': 4})
     self.assertEqual(actual._settings, {'length': 4, 'voice': 'all'})
Exemplo n.º 6
0
 def test_approach2(self):
     settings = {'length': 2, 'voice': 0}
     actual = approach.ApproachIndexer(lyst, settings).run()
     self.assertTrue(actual.equals(APPROACH))
Exemplo n.º 7
0
 def test_approach(self):
     """tests that running the approach indexer returns the expected results"""
     settings = {'length': 2}
     actual = approach.ApproachIndexer(lyst, settings).run()
     self.assertTrue(actual.equals(APPROACH))
Exemplo n.º 8
0
 def test_init2(self):
     """tests that __init__() works with all possible settings given"""
     settings = {'length': 3, 'voice': 0}
     actual = approach.ApproachIndexer(lyst, settings)
     self.assertEqual(actual._settings, settings)