def test_parse_monthly_income(self): test_data = sample_answers.dollar_answer_pairs for sample_input, expected_result in test_data.items(): data = {'monthly_income': sample_input} field = fields.MonthlyIncome(data) field.is_valid() self.assertEqual(field.parsed_data, expected_result)
def test_unreasonable_monthly_wage_makes_warning(self): high, low = ("$60,000", "1.543") for input_data in (high, low): data = {'monthly_income': input_data} field = fields.MonthlyIncome(data) field.is_valid() self.assertTrue(field.warnings)
def test_get_current_value_none_if_empty(self): """WholeDollarField.get_current_value() None if empty """ field = fields.MonthlyIncome() self.assertIsNone(field.get_current_value())
def test_is_okay_with_unset_raw_value(self): field = fields.MonthlyIncome({}) field.is_valid() self.assertIsNone(field.get_current_value())
def get_validated_monthly_income_field_with(input_value): data = {'monthly_income': input_value} field = fields.MonthlyIncome(data) field.is_valid() return field
def test_reasonable_monthly_wage_is_cool(self): data = {'monthly_income': "2,000"} field = fields.MonthlyIncome(data) field.is_valid() self.assertFalse(field.warnings)