expectedparrot / edsl

Design, conduct and analyze results of AI-powered surveys and experiments. Simulate social science and market research with large numbers of AI agents and LLMs.
https://docs.expectedparrot.com
MIT License
172 stars 18 forks source link

QuestionCheckBox and QuestionList validation #1047

Open onmyraedar opened 1 week ago

onmyraedar commented 1 week ago

I can initialize QuestionCheckBox with negative values for min_selections and max_selections - I don't think this should be the case?

>>> from edsl import QuestionCheckBox
>>> q = QuestionCheckBox(question_name="test", question_text="Please select your favorite option", question_options=["Option 1", "Option 2", "Option 3"], min_selections=-1, max_selections=-10)
>>> q
Question('checkbox', question_name = """test""", question_text = """Please select your favorite option""", min_selections = -1, max_selections = -10, question_options = ['Option 1', 'Option 2', 'Option 3'])
rbyh commented 1 week ago

It should not be - great catch!

onmyraedar commented 1 day ago

Updating this because I realized this is also true for QuestionList:

>>> from edsl import QuestionList
>>> q = QuestionList(question_name="favorite_foods", question_text="List your favorite foods.", max_list_items=-10)
>>> q
Question('list', question_name = """favorite_foods""", question_text = """List your favorite foods.""", max_list_items = -10)
rbyh commented 1 day ago

@onmyraedar thanks!