Skip to content

Commit

Permalink
added tests for parameter_product
Browse files Browse the repository at this point in the history
  • Loading branch information
am-tropin committed Nov 17, 2023
1 parent 0829b43 commit 41c1a4d
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 4 deletions.
42 changes: 40 additions & 2 deletions app/tests/.ipynb_checkpoints/test_function_store-checkpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,54 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "dc7808a1",
"metadata": {},
"outputs": [],
"source": [
"# import itertools\n",
"\n",
"# def parameter_product(parameters):\n",
"# params_values = [parameters[key] if isinstance(parameters[key], list) else [parameters[key]] for key in parameters.keys()]\n",
"# return [dict(zip(parameters.keys(), combination)) for combination in itertools.product(*params_values)]\n",
"\n",
"# parameter_product({'1': ['a', 'd'], '2': 'b', '3': 'c'})"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "77e36d5f",
"metadata": {},
"outputs": [],
"source": [
"def test_1_parameter_product():\n",
" assert parameter_product({'1': 'a', '2': 'c'}) == [{'1': 'a', '2': 'c'}]\n",
"\n",
"def test_2_parameter_product():\n",
" assert parameter_product({'1': ['a', 'b'], '2': 'c'}) == [{'1': 'a', '2': 'c'}, {'1': 'b', '2': 'c'}]\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "783783ff",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "37e10010",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "2faf0484",
"id": "6b86eb33",
"metadata": {},
"outputs": [],
"source": []
Expand Down
42 changes: 40 additions & 2 deletions app/tests/test_function_store.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,54 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "dc7808a1",
"metadata": {},
"outputs": [],
"source": [
"# import itertools\n",
"\n",
"# def parameter_product(parameters):\n",
"# params_values = [parameters[key] if isinstance(parameters[key], list) else [parameters[key]] for key in parameters.keys()]\n",
"# return [dict(zip(parameters.keys(), combination)) for combination in itertools.product(*params_values)]\n",
"\n",
"# parameter_product({'1': ['a', 'd'], '2': 'b', '3': 'c'})"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "77e36d5f",
"metadata": {},
"outputs": [],
"source": [
"def test_1_parameter_product():\n",
" assert parameter_product({'1': 'a', '2': 'c'}) == [{'1': 'a', '2': 'c'}]\n",
"\n",
"def test_2_parameter_product():\n",
" assert parameter_product({'1': ['a', 'b'], '2': 'c'}) == [{'1': 'a', '2': 'c'}, {'1': 'b', '2': 'c'}]\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "783783ff",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "37e10010",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "2faf0484",
"id": "6b86eb33",
"metadata": {},
"outputs": [],
"source": []
Expand Down
28 changes: 28 additions & 0 deletions app/tests/test_function_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,34 @@ def test_for_33_check_year():



# In[4]:


# import itertools

# def parameter_product(parameters):
# params_values = [parameters[key] if isinstance(parameters[key], list) else [parameters[key]] for key in parameters.keys()]
# return [dict(zip(parameters.keys(), combination)) for combination in itertools.product(*params_values)]

# parameter_product({'1': ['a', 'd'], '2': 'b', '3': 'c'})


# In[ ]:


def test_1_parameter_product():
assert parameter_product({'1': 'a', '2': 'c'}) == [{'1': 'a', '2': 'c'}]

def test_2_parameter_product():
assert parameter_product({'1': ['a', 'b'], '2': 'c'}) == [{'1': 'a', '2': 'c'}, {'1': 'b', '2': 'c'}]


# In[ ]:





# In[ ]:


Expand Down

0 comments on commit 41c1a4d

Please sign in to comment.