コード例 #1
0
 def test_for_item_not_found(self):
     with self.assertRaises(ValueError):
         ssa.search_array('cup')
コード例 #2
0
 def test_search_array(self):
     self.assertFalse(
         basic_list_exception.search_array([5, -1, 3, 6, 8, 9, 4, 10], -1))
コード例 #3
0
 def test_invalid_number(self):
     self.assertEqual(sort_and_search_array.search_array(20), -1)
コード例 #4
0
 def test_failed_search(self):
     the_array = arr.array('d', [2, 4, 6])
     self.assertEqual(topic1.search_array(the_array, 8), -1)
コード例 #5
0
 def test_search_array_found(self):
     self.assertEqual(ssa.search_array(5.9), 4)
コード例 #6
0
 def test_search_array_found(self):
     self.assertEqual(array.search_array(self.initial_array, 50), 50)
コード例 #7
0
 def test_search_array_item_not_found(self):
     self.assertEqual(a.search_array([9, 1, 4], 7), -1)
コード例 #8
0
 def test_search_list_item_not_found(self, input):
     with self.assertRaises(ValueError):
         sort_and_search_array.search_array()
コード例 #9
0
 def test_search_list_item_found(self, input):
     with self.assertEqual('7'):
         sort_and_search_array.search_array()
コード例 #10
0
 def test_search_array_found(self):
     self.assertTrue(sort_and_search_array.search_array('Reds'))
コード例 #11
0
 def test_search_array_not_found(self):
     result = sort_and_search_array.search_array('Yankees')
     self.assertEqual(result, '-1')
コード例 #12
0
 def test_search_array_not_found(self):
     """Test search_list function for valid output of item not in list"""
     self.assertEqual(search_array([6, 4, 9, 10], 15), -1)
コード例 #13
0
 def test_search_array(self, input):
     x = make_array()
     self.assertEqual(search_array(x), 2)
コード例 #14
0
 def test_search_list_item_found(self, input):
     self.assertEqual(ss.search_array(ss.make_array(), 25), 0)
コード例 #15
0
 def test_item_found(self, input):
     self.assertEqual(topic1.search_array(31), 1)
コード例 #16
0
 def test_search_not_in_array(self):
     self.assertEqual(search_array(-99), -1)
コード例 #17
0
 def test_search_array_not_found(self):
     self.assertEqual(array.search_array(self.initial_array, 36), -1)
コード例 #18
0
 def test_search_in_array(self):
     self.assertEqual(search_array(45), 1)
コード例 #19
0
 def test_search_array_item_found(self):
     self.assertEqual(a.search_array([8, 6, 'Hi'], 'Hi'), 2)
コード例 #20
0
def test_search(arr, value):
    index = sort_and_search_array.search_array(arr, value)
    if index == -1:
        print(value, "not present in the array")
    else:
        print(value, " present in the array at index: ", index)
コード例 #21
0
 def test_search_array(self, mock_input):
     result = sort_and_search_array.search_array()
     self.assertEqual(result, 1)
コード例 #22
0
 def test_search(self):
     f = [2, 3, 4, 9]
     value = 5
     expected_result = -1
     self.assertEqual(-1, sort_and_search_array.search_array([2, 3, 4, 9],
                                                             4))
コード例 #23
0
 def test_search(self):
     the_array = arr.array('d', [2, 4, 6])
     self.assertEqual(topic1.search_array(the_array, 4), 1)
コード例 #24
0
 def test_search_array(self):
     self.assertEqual(search_array(33), 4)
コード例 #25
0
 def test_search_array_not_found(self):
     with self.assertRaises(ValueError):
         ssa.search_array(69)
コード例 #26
0
 def test_search_array_item_found(self, mock_input):
     self.assertEqual(
         3,
         sort_and_search_array.search_array(
             arr.array('I', [1, 4, 5, 36, 99])))
コード例 #27
0
 def test_valid_number(self):
     self.assertEqual(sort_and_search_array.search_array(3), 2)
コード例 #28
0
 def test_item_not_found(self, input):
     self.assertEqual(topic1.search_array(15), -1)
コード例 #29
0
 def test_array_search(self):
     test_Array = array([1,7,4,6,5])
     self.assertEqual(2, sort_and_search_array.search_array(test_Array)) #inputed 4 to return 2 index
コード例 #30
0
 def test_for_item_found(self):
     self.assertEqual(ssa.search_array(2.3), 1)