def test_get_true_positives_returns_correct_number_of_entries(): tpms = _get_test_tpms() t.mark_positives_and_negatives(tpms) tp_tpms = t.get_true_positives(tpms) assert len(tp_tpms) == \ len([x for x, y in zip(CALC_TPMS_VALS, REAL_TPMS_VALS) if x > t.NOT_PRESENT_CUTOFF and y > t.NOT_PRESENT_CUTOFF])
def test_get_true_positives_returns_correct_number_of_entries(): tpms = _get_test_tpms() t.mark_positives_and_negatives(NOT_PRESENT_CUTOFF, tpms) tp_tpms = t.get_true_positives(tpms) assert len(tp_tpms) == \ len([x for x, y in zip(CALC_TPMS_VALS, REAL_TPMS_VALS) if x > NOT_PRESENT_CUTOFF and y > NOT_PRESENT_CUTOFF])
def _get_test_tpms(): tpms = pd.DataFrame.from_dict({ t.REAL_TPM: test_tpms.REAL_TPMS_VALS, t.CALCULATED_TPM: test_tpms.CALC_TPMS_VALS, test_tpms.GROUP_TEST_COL: test_tpms.GROUPS }) t.calculate_log_ratios(tpms) t.calculate_percent_error(tpms) t.mark_positives_and_negatives(tpms) return tpms, t.get_true_positives(tpms)