'Build a radio or checkbox group, parse it and check the resuls against the
expected output.
`tag` should be \'checkboxtextgroup\' or \'radiotextgroup\'
`choice_tag` is either \'choice\' for proper xml, or any other value to trigger an error.
`expected_input_type` is either \'radio\' or \'checkbox\'.'

def check_group(self, tag, choice_tag, expected_input_type):

    xml_str = '\n        <{tag}>\n                        <{choice_tag}    correct="false"    name="choiceinput_0">this    is<numtolerance_input    name="choiceinput_0_textinput_0"/>false</{choice_tag}>\n                        <choice    correct="true"    name="choiceinput_1">Is    a    number<decoy_input    name="choiceinput_1_textinput_0"/><text>!</text></choice>\n        </{tag}>\n                                '.format(tag=tag, choice_tag=choice_tag)
    element = etree.fromstring(xml_str)
    prob_id = 'choicetext_input'
    state = {'value': '{}', 'id': prob_id, 'status': inputtypes.Status('answered'), 'response_data': RESPONSE_DATA}
    first_input = self.build_choice_element('numtolerance_input', 'choiceinput_0_textinput_0', 'false', '')
    second_input = self.build_choice_element('decoy_input', 'choiceinput_1_textinput_0', '', '')
    first_choice_content = self.build_choice_element('text', 'this    is', '', '')
    second_choice_content = self.build_choice_element('text', 'Is    a    number', '', '')
    second_choice_text = self.build_choice_element('text', '!', '', '')
    choices = [('choiceinput_0', [first_choice_content, first_input]), ('choiceinput_1', [second_choice_content, second_input, second_choice_text])]
    expected = {'STATIC_URL': '/dummy-static/', 'msg': '', 'input_type': expected_input_type, 'choices': choices, 'show_correctness': 'always', 'submitted_message': 'Answer    received.', 'response_data': RESPONSE_DATA, 'describedby_html': DESCRIBEDBY.format(status_id=prob_id)}
    expected.update(state)
    the_input = lookup_tag(tag)(test_capa_system(), element, state)
    context = the_input._get_render_context()
    self.assertEqual(context, expected)
