30 Day code challenge-python

--

Day 27— Testing

Task

Finish the implementation of classes to provide data and expected results for the tests.

Complete the following methods.

In the class TestDataEmptyArray:

  • get_array() returns an empty array

In the class TestDataEmptyArray:

  • get_array() returns an array of size at least 2 with all unique elements
  • get_expected_result() returns the expected minimum value index for this array

In the class TestDataExactlyTwoDifferentMinimums:

  • get_array() returns an array where the minimum value occurs at exactly 2 indices
  • get_expected_result() returns the expected index
Solution

Explanation

Line 73–75: Calls the three functions.

Line 42–71: Calls the three classes TestDataEmptyArray , TestDataUniqueValues , and TestDataExactlyTwoDifferentMinimums.

Line 9–40: Returns the empty array, unique values in an array and two difference minimums in an array.

Line 76: Prints the “OK” if the above code is implemented correctly.

See you on day 28

--

--