Tests

Fix the Code 2


This is a follow up to Fix the Code 1.

Write tests for your Fix the Code 1 code for the following cases and save it in a file called test_granger_analysis_code.py (remember that the file has to start with test_ for nose to find it). Make any corrections/improvements that need to be made to the code so that all of your tests pass.

gc_content()

  1. Sequence represented by upper case string
  2. Sequence represented by lower case string
  3. Sequence represented by mixed case string
  4. Sequence represented by multiline string

get_size_class()

In an email accompanying your “updated” code, Dr. Granger indicated that the specifications for the earlength size classes were:

  1. extralarge: earlength >= 15
  2. large: 10 <= earlength < 15
  3. medium: 8 <= earlength < 10
  4. small: earlength < 8

Write tests to check:

  1. that each case is working when the numbers are in the range,
  2. the edge cases of 8, 10, and 15, and
  3. what happens if non-numerical values are passed to the function (e.g., a string from a header row that didn’t get removed).