def test_overlapping_dim_indicator_variable(self, mock_question_key, resp_for_overlap_dim, monkeypatch): res = Processor(question_key=mock_question_key, survey_results=resp_for_overlap_dim).dimension_values res = res.reset_index().set_index(["Entry Id", "dimension_code"]) assert res.loc[(1, "QC3"), "bin"] == "QC3" assert res.loc[(2, "QC3"), "bin"] == "not_QC3"
def test_dimension_value_frame(self, mock_question_key, resp_for_overlap_dim): exp_r = [(1, "QC3", 2, 1.0), (2, "not_QC3", None, 0.0)] exp_c = ["Entry Id", "dimension", "value", "dimension_as_num"] exp_df = pd.DataFrame.from_records(exp_r, columns=exp_c).set_index("Entry Id") p = Processor(question_key=mock_question_key, survey_results=resp_for_overlap_dim) assert_frame_subset(p.dimension_value_frame("QC3", "QC2"), exp_df)
def test_all_questions(self, mock_question_key): exp = ["QC2"] p = Processor(question_key=mock_question_key) assert p.all_questions() == exp
def test_all_dimensions(self, mock_question_key): exp = ["QC1", "QC3", "QC4"] p = Processor(question_key=mock_question_key) assert p.all_dimensions() == exp
def test_questions_in_group(self, mock_question_key): exp = ["QC2"] p = Processor(question_key=mock_question_key) assert p.questions_in_group("G2") == exp
def test_dimensions_in_group(self, mock_question_key): exp = ["QC3", "QC4"] p = Processor(question_key=mock_question_key) assert p.dimensions_in_group("G3") == exp