From 405e215b046ea042fc7943bc0b96d0ef3a6626d6 Mon Sep 17 00:00:00 2001 From: David Pratten Date: Wed, 4 Jan 2023 15:12:05 +1100 Subject: [PATCH] Separate Tests into one test file per mzn file --- Birthday Money.ipynb | 2 +- Dockerfile | 2 +- jetisu/idr_query.py | 2 + jetisu/query_idr_magic.py | 2 +- jetisu/test_ACT_Conveyance_Duty.py | 85 +++++++ jetisu/test_Australian_GST.py | 13 ++ jetisu/test_idr_query.py | 308 ++++++++++++++----------- jetisu/test_new_birthday_money.py | 17 ++ jetisu/test_range.py | 19 ++ jetisu/test_standard_birthday_money.py | 7 + 10 files changed, 324 insertions(+), 133 deletions(-) create mode 100644 jetisu/test_ACT_Conveyance_Duty.py create mode 100644 jetisu/test_Australian_GST.py create mode 100644 jetisu/test_new_birthday_money.py create mode 100644 jetisu/test_range.py create mode 100644 jetisu/test_standard_birthday_money.py diff --git a/Birthday Money.ipynb b/Birthday Money.ipynb index 2a30c74..5ec5dd1 100644 --- a/Birthday Money.ipynb +++ b/Birthday Money.ipynb @@ -328,7 +328,7 @@ " where age = 10\n", " and birthday_money = 200;\n", "\"\"\", 'data')\n", - " assert sorted_res(res) == sorted_res((('good_behaviour',), [(True,)]))\n" + " assert idr_test_res_sort(res) == idr_test_res_sort((('good_behaviour',), [(True,)]))\n" ] } ], diff --git a/Dockerfile b/Dockerfile index 529df37..e32613b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,7 +30,7 @@ COPY jetisu/query_idr_magic.py /home/${NB_USER}/jetisu/ COPY jetisu/idr_query.py /home/${NB_USER}/jetisu/ COPY jetisu/*.mzn /home/${NB_USER}/jetisu/ COPY *.ipynb /home/${NB_USER} -COPY jetisu/test_idr_query.py /home/${NB_USER}/jetisu/ +COPY jetisu/test_*.py /home/${NB_USER}/jetisu/ RUN rmdir /home/${NB_USER}/work # Return to User level USER ${NB_UID} diff --git a/jetisu/idr_query.py b/jetisu/idr_query.py index 834f85a..0b9d403 100644 --- a/jetisu/idr_query.py +++ b/jetisu/idr_query.py @@ -19,6 +19,8 @@ def idr_read_model(canonical_table_name): with open('jetisu/' + canonical_table_name + '.mzn', 'r') as file: return file.read() +def idr_test_res_sort(res): + return (res[0], sorted(res[1], key=lambda element: "".join([str(x) for x in element]))) def mzn_quote(k, v, typed_parameters_dict): if typed_parameters_dict[k] == 'bool': diff --git a/jetisu/query_idr_magic.py b/jetisu/query_idr_magic.py index 8f19c01..3e18621 100644 --- a/jetisu/query_idr_magic.py +++ b/jetisu/query_idr_magic.py @@ -10,7 +10,7 @@ def jetisu_query(line, cell): def jetisu_testcase(line, cell): print("""def test_idr_""" + hashlib.sha1(cell.strip().encode()).hexdigest()[:10] + """(): res = idr_query(\"\"\"""" + cell + """\"\"\", 'data') - assert sorted_res(res) == sorted_res(""" + str(idr_query(cell, 'data')) + """)""") + assert idr_test_res_sort(res) == idr_test_res_sort(""" + str(idr_query(cell, 'data')) + """)""") def jetisu_show(line, cell): diff --git a/jetisu/test_ACT_Conveyance_Duty.py b/jetisu/test_ACT_Conveyance_Duty.py new file mode 100644 index 0000000..2cfdf9e --- /dev/null +++ b/jetisu/test_ACT_Conveyance_Duty.py @@ -0,0 +1,85 @@ +from jetisu.idr_query import idr_query, idr_test_res_sort + + +def test_idr_d750d38a4a(): + res = idr_query("""select price, duty from ACT_Conveyance_Duty where price = 1200000 and eligible_owner_occupier; +""", 'data') + assert idr_test_res_sort(res) == idr_test_res_sort((('price', 'duty'), [(1200000.0, 47590)])) + + +def test_idr_0a5180a61c(): + res = idr_query("""select price, duty from ACT_Conveyance_Duty where price = 1200000 and not non_commercial; +""", 'data') + assert idr_test_res_sort(res) == idr_test_res_sort((('price', 'duty'), [(1200000.0, 0.0)])) + + +def test_idr_65378a8e35(): + res = idr_query("""select eligible_owner_occupier, duty + from ACT_Conveyance_Duty + where price = 1200000 and non_commercial; +""", 'data') + assert idr_test_res_sort(res) == idr_test_res_sort((('eligible_owner_occupier', 'duty'), [(True, 47590), (False, 49750)])) + + +def test_idr_347d205d95(): + res = idr_query(""" +select * from ACT_Conveyance_Duty where price = 1200000; + +""", 'data') + assert idr_test_res_sort(res) == idr_test_res_sort((('non_commercial', 'eligible_owner_occupier', 'price', 'duty'), + [(False, False, 1200000.0, 0), (True, True, 1200000.0, 47590), + (True, False, 1200000.0, 49750)])) + + +def test_idr_689c1ce3d5(): + res = idr_query(""" +select * from ACT_Conveyance_Duty where price = 2000000; + +""", 'data') + assert idr_test_res_sort(res) == idr_test_res_sort((('non_commercial', 'eligible_owner_occupier', 'price', 'duty'), + [(True, True, 2000000.0, 90800), (True, False, 2000000.0, 90800), + (False, False, 2000000.0, 100000)])) + + +def test_idr_4ab4e9269f(): + res = idr_query(""" +select price from ACT_Conveyance_Duty where duty = 50150 and eligible_owner_occupier; + +""", 'data') + assert idr_test_res_sort(res) == idr_test_res_sort((('price',), + [(1240000,), (1239901,), (1239902,), (1239903,), (1239904,), (1239905,), + (1239906,), (1239907,), (1239908,), (1239909,), (1239910,), (1239911,), + (1239912,), (1239913,), (1239914,), (1239915,), (1239916,), (1239917,), + (1239918,), (1239919,), (1239920,), (1239921,), (1239922,), (1239923,), + (1239924,), (1239925,), (1239926,), (1239927,), (1239928,), (1239929,), + (1239930,), (1239931,), (1239932,), (1239933,), (1239934,), (1239935,), + (1239936,), (1239937,), (1239938,), (1239939,), (1239940,), (1239941,), + (1239942,), (1239943,), (1239944,), (1239945,), (1239946,), (1239947,), + (1239948,), (1239949,), (1239950,), (1239951,), (1239952,), (1239953,), + (1239954,), (1239955,), (1239956,), (1239957,), (1239958,), (1239959,), + (1239960,), (1239961,), (1239962,), (1239963,), (1239964,), (1239965,), + (1239966,), (1239967,), (1239968,), (1239969,), (1239970,), (1239971,), + (1239972,), (1239973,), (1239974,), (1239975,), (1239976,), (1239977,), + (1239978,), (1239979,), (1239980,), (1239981,), (1239982,), (1239983,), + (1239984,), (1239985,), (1239986,), (1239987,), (1239988,), (1239989,), + (1239990,), (1239991,), (1239992,), (1239993,), (1239994,), (1239995,), + (1239996,), (1239997,), (1239998,), (1239999,)])) + + +def test_idr_fe0f141905(): + res = idr_query(""" +select non_commercial, + eligible_owner_occupier, + min(price) min_price, + max(price) max_price +from ACT_Conveyance_Duty +where duty = 140740 +group by non_commercial, + eligible_owner_occupier; + +""", 'data') + assert idr_test_res_sort(res) == idr_test_res_sort((('non_commercial', 'eligible_owner_occupier', 'min_price', 'max_price'), + [(False, False, 2814701, 2814800), (True, False, 3099901, 3100000), + (True, True, 3099901, 3100000)])) + + diff --git a/jetisu/test_Australian_GST.py b/jetisu/test_Australian_GST.py new file mode 100644 index 0000000..086f01a --- /dev/null +++ b/jetisu/test_Australian_GST.py @@ -0,0 +1,13 @@ +from jetisu.idr_query import idr_query, idr_test_res_sort + +def test_idr_60cade641e(): + res = idr_query("""select * from australian_gst where price = 110; +""", 'data') + assert idr_test_res_sort(res) == idr_test_res_sort((('price', 'ex_gst_amount', 'gst_amount'), [(110.0, 100.0, 10.0)])) + + +def test_idr_c46f0fe5f7(): + res = idr_query("""select * from Australian_GST where price=100 and ex_gst_amount=1 and gst_amount=1; +""", 'data') + assert idr_test_res_sort(res) == idr_test_res_sort((('price', 'ex_gst_amount', 'gst_amount'), [])) + diff --git a/jetisu/test_idr_query.py b/jetisu/test_idr_query.py index 3dde695..a011f58 100644 --- a/jetisu/test_idr_query.py +++ b/jetisu/test_idr_query.py @@ -1,136 +1,184 @@ -from jetisu.idr_query import idr_query - - -def sorted_res(res): - return (res[0], sorted(res[1], key=lambda element: "".join([str(x) for x in element]))) - - -def test_idr_d750d38a4a(): - res = idr_query("""select price, duty from ACT_Conveyance_Duty where price = 1200000 and eligible_owner_occupier; -""", 'data') - assert sorted_res(res) == sorted_res((('price', 'duty'), [(1200000.0, 47590)])) - -def test_idr_0a5180a61c(): - res = idr_query("""select price, duty from ACT_Conveyance_Duty where price = 1200000 and not non_commercial; -""", 'data') - assert sorted_res(res) == sorted_res((('price', 'duty'), [(1200000.0, 0.0)])) +from jetisu.idr_query import idr_query, idr_test_res_sort +def test_idr_779c4c4437(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'new_south_wales' and work_sector = 'education' and not specialist_school and not aged_care_facility and not private_home_only and not disability_worker_in_school and not NSW_health_worker;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(False, 0,)])) -def test_idr_65378a8e35(): - res = idr_query("""select eligible_owner_occupier, duty - from ACT_Conveyance_Duty - where price = 1200000 and non_commercial; -""", 'data') - assert sorted_res(res) == sorted_res((('eligible_owner_occupier', 'duty'), [(True, 47590), (False, 49750)])) +def test_idr_8cf6c5e4d6(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'new_south_wales' and work_sector = 'education' and not specialist_school and not aged_care_facility and not private_home_only and disability_worker_in_school and not NSW_health_worker;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(True, 3,)])) -def test_idr_347d205d95(): - res = idr_query(""" -select * from ACT_Conveyance_Duty where price = 1200000; -""", 'data') - assert sorted_res(res) == sorted_res((('non_commercial', 'eligible_owner_occupier', 'price', 'duty'), - [(False, False, 1200000.0, 0), (True, True, 1200000.0, 47590), - (True, False, 1200000.0, 49750)])) +def test_idr_25ecd837f4(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'new_south_wales' and work_sector = 'aged_care' and not specialist_school and not aged_care_facility and not private_home_only and not disability_worker_in_school and not NSW_health_worker;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(True, 2,)])) #OpenFisca has 3 - -def test_idr_689c1ce3d5(): - res = idr_query(""" -select * from ACT_Conveyance_Duty where price = 2000000; - -""", 'data') - assert sorted_res(res) == sorted_res((('non_commercial', 'eligible_owner_occupier', 'price', 'duty'), - [(True, True, 2000000.0, 90800), (True, False, 2000000.0, 90800), - (False, False, 2000000.0, 100000)])) - - -def test_idr_4ab4e9269f(): - res = idr_query(""" -select price from ACT_Conveyance_Duty where duty = 50150 and eligible_owner_occupier; - -""", 'data') - assert sorted_res(res) == sorted_res((('price',), - [(1240000,), (1239901,), (1239902,), (1239903,), (1239904,), (1239905,), - (1239906,), (1239907,), (1239908,), (1239909,), (1239910,), (1239911,), - (1239912,), (1239913,), (1239914,), (1239915,), (1239916,), (1239917,), - (1239918,), (1239919,), (1239920,), (1239921,), (1239922,), (1239923,), - (1239924,), (1239925,), (1239926,), (1239927,), (1239928,), (1239929,), - (1239930,), (1239931,), (1239932,), (1239933,), (1239934,), (1239935,), - (1239936,), (1239937,), (1239938,), (1239939,), (1239940,), (1239941,), - (1239942,), (1239943,), (1239944,), (1239945,), (1239946,), (1239947,), - (1239948,), (1239949,), (1239950,), (1239951,), (1239952,), (1239953,), - (1239954,), (1239955,), (1239956,), (1239957,), (1239958,), (1239959,), - (1239960,), (1239961,), (1239962,), (1239963,), (1239964,), (1239965,), - (1239966,), (1239967,), (1239968,), (1239969,), (1239970,), (1239971,), - (1239972,), (1239973,), (1239974,), (1239975,), (1239976,), (1239977,), - (1239978,), (1239979,), (1239980,), (1239981,), (1239982,), (1239983,), - (1239984,), (1239985,), (1239986,), (1239987,), (1239988,), (1239989,), - (1239990,), (1239991,), (1239992,), (1239993,), (1239994,), (1239995,), - (1239996,), (1239997,), (1239998,), (1239999,)])) - - -def test_idr_fe0f141905(): - res = idr_query(""" -select non_commercial, - eligible_owner_occupier, - min(price) min_price, - max(price) max_price -from ACT_Conveyance_Duty -where duty = 140740 -group by non_commercial, - eligible_owner_occupier; - -""", 'data') - assert sorted_res(res) == sorted_res((('non_commercial', 'eligible_owner_occupier', 'min_price', 'max_price'), - [(False, False, 2814701, 2814800), (True, False, 3099901, 3100000), - (True, True, 3099901, 3100000)])) - - -def test_idr_83827ed0a8(): - res = idr_query("""select * from range where N=5 and From_Start=10 and To_Stop = 20; -""", 'data') - assert sorted_res(res) == sorted_res((('from_start', 'to_stop', 'n', 'nth', 'nth_value'), - [(10.0, 20.0, 5.0, 0, 10), (10.0, 20.0, 5.0, 1, 12.5), - (10.0, 20.0, 5.0, 2, 15), (10.0, 20.0, 5.0, 3, 17.5), - (10.0, 20.0, 5.0, 4, 20)])) - - -def test_idr_4346617aaa(): - res = idr_query("""select * from range where N=5 and To_Stop = 20 and nth_Value=15.0; -""", 'data') - assert sorted_res(res) == sorted_res((('from_start', 'to_stop', 'n', 'nth', 'nth_value'), - [(15, 20.0, 5.0, 0, 15.0), (13.3333333333, 20.0, 5.0, 1, 15.0), - (10, 20.0, 5.0, 2, 15.0), (0, 20.0, 5.0, 3, 15.0)])) - - -def test_idr_60cade641e(): - res = idr_query("""select * from australian_gst where price = 110; -""", 'data') - assert sorted_res(res) == sorted_res((('price', 'ex_gst_amount', 'gst_amount'), [(110.0, 100.0, 10.0)])) - - -def test_idr_c46f0fe5f7(): - res = idr_query("""select * from Australian_GST where price=100 and ex_gst_amount=1 and gst_amount=1; -""", 'data') - assert sorted_res(res) == sorted_res((('price', 'ex_gst_amount', 'gst_amount'), [])) - - -def test_idr_f6a1458c80(): - res = idr_query("""select * from standard_birthday_money where age = 10; -""", 'data') - assert sorted_res(res) == sorted_res((('age', 'birthday_money'), [(10.0, 100.0)])) - - -def test_idr_4c8196e3fb(): - res = idr_query("""select * from new_birthday_money where age = 10 ; -""", 'data') - assert sorted_res(res) == sorted_res( - (('age', 'good_behaviour', 'birthday_money'), [(10.0, False, 0), (10.0, True, 200)])) - - -def test_idr_4cbd6b19e0(): - res = idr_query("""select good_behaviour from new_birthday_money - where age = 10 - and birthday_money = 200; -""", 'data') - assert sorted_res(res) == sorted_res((('good_behaviour',), [(True,)])) + +def test_idr_27f5fc7737(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'new_south_wales' and work_sector = 'aged_care' and not specialist_school and aged_care_facility and not private_home_only and not disability_worker_in_school and not NSW_health_worker;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(True, 3,)])) #OpenFisca has 2 + + +def test_idr_d215ef1efe(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'new_south_wales' and work_sector = 'disability_services' and not specialist_school and not aged_care_facility and not private_home_only and not disability_worker_in_school and not NSW_health_worker;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(True, 3,)])) + + +def test_idr_a804e12acd(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'new_south_wales' and work_sector = 'healthcare' and not specialist_school and not aged_care_facility and not private_home_only and not disability_worker_in_school and not NSW_health_worker;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(False, 0,)])) + + +def test_idr_1e6faaafd3(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'new_south_wales' and work_sector = 'healthcare' and not specialist_school and not aged_care_facility and not private_home_only and not disability_worker_in_school and NSW_health_worker;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(True, 3,)])) #Open Fisca has 2 + + +def test_idr_759fdd7e05(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'victoria' and work_sector = 'education' and not specialist_school and not aged_care_facility and not private_home_only and not disability_worker_in_school;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(False, 0,)])) + + +def test_idr_0e5aeda14a(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'victoria' and work_sector = 'education' and specialist_school and not aged_care_facility and not private_home_only and not disability_worker_in_school;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(True, 3,)])) + + +def test_idr_ccfc72abad(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'victoria' and work_sector = 'aged_care' and not specialist_school and not aged_care_facility and not private_home_only and not disability_worker_in_school;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(False, 0,)])) + + +def test_idr_ff6c3a243b(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'victoria' and work_sector = 'aged_care' and not specialist_school and aged_care_facility and not private_home_only and not disability_worker_in_school;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(True, 3,)])) + + +def test_idr_39175ae158(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'victoria' and work_sector = 'custodial' and not specialist_school and not aged_care_facility and not private_home_only and not disability_worker_in_school;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(True, 3,)])) + + +def test_idr_ecb3d3ca89(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'victoria' and work_sector = 'emergency_services' and not specialist_school and not aged_care_facility and not private_home_only and not disability_worker_in_school;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(True, 3,)])) + + +def test_idr_801edd720f(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'victoria' and work_sector = 'disability_services' and not specialist_school and not aged_care_facility and not private_home_only and not disability_worker_in_school;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(True, 3,)])) + + +def test_idr_97a1275a44(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'victoria' and work_sector = 'healthcare' and not specialist_school and not aged_care_facility and not private_home_only and not disability_worker_in_school;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(True, 3,)])) + + +def test_idr_8270d50dab(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'victoria' and work_sector = 'other' and not specialist_school and not aged_care_facility and not private_home_only and not disability_worker_in_school;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(False, 0,)])) + + +def test_idr_8ca185cf29(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'western_australia' and work_sector = 'aged_care' and not specialist_school and not aged_care_facility and not private_home_only and not disability_worker_in_school;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(True, 3,)])) + + +def test_idr_6156129e26(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'western_australia' and work_sector = 'aged_care' and not specialist_school and not aged_care_facility and private_home_only and not disability_worker_in_school;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(False, 0,)])) + + +def test_idr_ba53fe09ca(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'western_australia' and work_sector = 'disability_services' and not specialist_school and not aged_care_facility and not private_home_only and not disability_worker_in_school;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(True, 3,)])) + + +def test_idr_78919e5e14(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'western_australia' and work_sector = 'disability_services' and not specialist_school and not aged_care_facility and private_home_only and not disability_worker_in_school;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(False, 0,)])) + + +def test_idr_91db09afd5(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'western_australia' and work_sector = 'healthcare' and not specialist_school and not aged_care_facility and not private_home_only and not disability_worker_in_school;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(True, 3,)])) + + +def test_idr_6d6236eb3a(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'western_australia' and work_sector = 'healthcare' and not specialist_school and not aged_care_facility and private_home_only and not disability_worker_in_school;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(False, 0,)])) + + +def test_idr_ba0365d9ba(): + res = idr_query( + """select covid_vaccination_work_mandatory, covid_vaccination_work_recommended_doses from covid_vaccinations_and_work where work_location = 'western_australia' and work_sector = 'other' and not specialist_school and not aged_care_facility and private_home_only and not disability_worker_in_school;""", + 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('covid_vaccination_work_mandatory', 'covid_vaccination_work_recommended_doses',), [(False, 0,)])) \ No newline at end of file diff --git a/jetisu/test_new_birthday_money.py b/jetisu/test_new_birthday_money.py new file mode 100644 index 0000000..01572a7 --- /dev/null +++ b/jetisu/test_new_birthday_money.py @@ -0,0 +1,17 @@ +from jetisu.idr_query import idr_query, idr_test_res_sort + + +def test_idr_4c8196e3fb(): + res = idr_query("""select * from new_birthday_money where age = 10 ; +""", 'data') + assert idr_test_res_sort(res) == idr_test_res_sort( + (('age', 'good_behaviour', 'birthday_money'), [(10.0, False, 0), (10.0, True, 200)])) + + +def test_idr_4cbd6b19e0(): + res = idr_query("""select good_behaviour from new_birthday_money + where age = 10 + and birthday_money = 200; +""", 'data') + assert idr_test_res_sort(res) == idr_test_res_sort((('good_behaviour',), [(True,)])) + diff --git a/jetisu/test_range.py b/jetisu/test_range.py new file mode 100644 index 0000000..178226e --- /dev/null +++ b/jetisu/test_range.py @@ -0,0 +1,19 @@ +from jetisu.idr_query import idr_query, idr_test_res_sort + + +def test_idr_83827ed0a8(): + res = idr_query("""select * from range where N=5 and From_Start=10 and To_Stop = 20; +""", 'data') + assert idr_test_res_sort(res) == idr_test_res_sort((('from_start', 'to_stop', 'n', 'nth', 'nth_value'), + [(10.0, 20.0, 5.0, 0, 10), (10.0, 20.0, 5.0, 1, 12.5), + (10.0, 20.0, 5.0, 2, 15), (10.0, 20.0, 5.0, 3, 17.5), + (10.0, 20.0, 5.0, 4, 20)])) + + +def test_idr_4346617aaa(): + res = idr_query("""select * from range where N=5 and To_Stop = 20 and nth_Value=15.0; +""", 'data') + assert idr_test_res_sort(res) == idr_test_res_sort((('from_start', 'to_stop', 'n', 'nth', 'nth_value'), + [(15, 20.0, 5.0, 0, 15.0), (13.3333333333, 20.0, 5.0, 1, 15.0), + (10, 20.0, 5.0, 2, 15.0), (0, 20.0, 5.0, 3, 15.0)])) + diff --git a/jetisu/test_standard_birthday_money.py b/jetisu/test_standard_birthday_money.py new file mode 100644 index 0000000..42f5e36 --- /dev/null +++ b/jetisu/test_standard_birthday_money.py @@ -0,0 +1,7 @@ +from jetisu.idr_query import idr_query, idr_test_res_sort + +def test_idr_f6a1458c80(): + res = idr_query("""select * from standard_birthday_money where age = 10; +""", 'data') + assert idr_test_res_sort(res) == idr_test_res_sort((('age', 'birthday_money'), [(10.0, 100.0)])) +