Skip to content

Commit

Permalink
Remove intersects arg from py2adql test - not its responsibility
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmcloaiza committed Dec 5, 2024
1 parent b938d16 commit fd0859d
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions astroquery/eso/tests/test_eso.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,18 +232,18 @@ def test_py2adql():

q = py2adql('pinko.Pallino', ['pippo', 'tizio', 'caio'],
where_constraints=['asdf > 1', 'asdf < 2', 'asdf = 3', 'asdf != 4'],
intersects=(1, 2, 3, 4), order_by='order_col')
order_by='order_col')
eq = "select pippo, tizio, caio from pinko.Pallino " + \
"where asdf > 1 and asdf < 2 and asdf = 3 and asdf != 4 and " + \
"intersects(1, circle('ICRS', 2, 3, 4))=1 order by order_col desc" # JM check here!!
"where asdf > 1 and asdf < 2 and asdf = 3 and asdf != 4 " + \
"order by order_col desc" # JM check here!!
assert eq == q, f"Expected:\n{eq}\n\nObtained:\n{q}\n\n"

q = py2adql('pinko.Pallino', ['pippo', 'tizio', 'caio'],
where_constraints=["asdf = 'ASDF'", "bcd = 'BCD'"],
intersects=(1, 2, 3, 4), order_by='order_col')
order_by='order_col')
eq = "select pippo, tizio, caio from pinko.Pallino " + \
"where asdf = 'ASDF' and bcd = 'BCD' and " + \
"intersects(1, circle('ICRS', 2, 3, 4))=1 order by order_col desc" # JM check here!!
"where asdf = 'ASDF' and bcd = 'BCD' " + \
"order by order_col desc" # JM check here!!
assert eq == q, f"Expected:\n{eq}\n\nObtained:\n{q}\n\n"

# All arguments
Expand All @@ -252,21 +252,20 @@ def test_py2adql():
'proposal_id, obs_collection'
table = 'ivoa.ObsCore'
and_c_list = ['em_min>4.0e-7', 'em_max<1.2e-6', 'asdasdads']
intersects_tuple = ("s_region", 109.668246, -24.5587, 0.001389)

q = py2adql(columns=columns, table=table,
where_constraints=and_c_list, intersects=intersects_tuple,
where_constraints=and_c_list,
order_by='snr', order_by_desc=True)
expected_query = 'select ' + columns + ' from ' + table + \
' where ' + and_c_list[0] + ' and ' + and_c_list[1] + ' and ' + and_c_list[2] + \
' and ' + "intersects(s_region, circle('ICRS', 109.668246, -24.5587, 0.001389))=1 order by snr desc"
" order by snr desc"
assert expected_query == q, f"Expected:\n{expected_query}\n\nObtained:\n{q}\n\n"

# All arguments
q = py2adql(columns=columns, table=table,
where_constraints=and_c_list, intersects=intersects_tuple,
where_constraints=and_c_list,
order_by='snr', order_by_desc=False)
expected_query = 'select ' + columns + ' from ' + table + \
' where ' + and_c_list[0] + ' and ' + and_c_list[1] + ' and ' + and_c_list[2] + \
' and ' + "intersects(s_region, circle('ICRS', 109.668246, -24.5587, 0.001389))=1 order by snr asc"
" order by snr asc"
assert expected_query == q, f"Expected:\n{expected_query}\n\nObtained:\n{q}\n\n"

0 comments on commit fd0859d

Please sign in to comment.