Exemplo n.º 1
0
 def test_option_str(self):
     question_options = 'ignore_case'
     question_option_defs = utils.dehumanize_question_options(
         question_options
     )
     exp = {'ignore_case_flag': 1}
     self.assertEquals(question_option_defs, exp)
Exemplo n.º 2
0
 def test_option_list_multi(self):
     question_options = ['ignore_case', 'and']
     question_option_defs = utils.dehumanize_question_options(
         question_options
     )
     exp = {'ignore_case_flag': 1, 'and_flag': 1}
     self.assertEquals(question_option_defs, exp)
Exemplo n.º 3
0
 def test_empty_optionlist(self):
     question_options = []
     question_option_defs = utils.dehumanize_question_options(
         question_options
     )
     exp = {}
     self.assertEquals(question_option_defs, exp)
Exemplo n.º 4
0
 def test_option_list_many(self):
     question_options = [
         'ignore_case', 'and', 'value_type:string', 'max_data_age:3600',
     ]
     question_option_defs = utils.dehumanize_question_options(
         question_options
     )
     exp = {
         'value_type': 'string',
         'ignore_case_flag': 1,
         'max_age_seconds': '3600',
         'and_flag': 1
     }
     self.assertEquals(question_option_defs, exp)
Exemplo n.º 5
0
 def test_invalid_option2(self):
     o = 'willy wonka'
     e = "Option '{}' is not a valid option!".format(o)
     with self.assertRaisesRegexp(HumanParserError, e):
         question_options = o
         utils.dehumanize_question_options(question_options)