Skip to content

Commit f221b54

Browse files
authored
Updating reference tables to include CompanionList (#188)
* Updating reference tables * updating test
1 parent 111a25b commit f221b54

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

simple_app/tests/test_utils.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,13 @@ def test_one_df_query(db):
130130
assert db
131131
bad_query = 'thisisabadquery'
132132
good_query = 'twa'
133+
133134
# test search object
134135
results = db.search_object(bad_query, fmt='pandas')
135136
assert not len(results) # bad query should return empty table
136137
results = db.search_object(good_query, fmt='pandas')
137138
assert isinstance(results, pd.DataFrame)
139+
138140
# test search string
139141
with pytest.raises(KeyError):
140142
ref_results: Optional[dict] = db.search_string(bad_query, fmt='pandas', verbose=False)
@@ -146,21 +148,26 @@ def test_one_df_query(db):
146148
filtered_results: Optional[pd.DataFrame] = results.merge(ref_sources, on='source', suffixes=(None, 'extra'))
147149
assert isinstance(filtered_results, pd.DataFrame)
148150
filtered_results.drop(columns=list(filtered_results.filter(regex='extra')), inplace=True)
151+
149152
# test one_df_query
150153
stringed_results = one_df_query(filtered_results)
151154
assert isinstance(stringed_results, str)
155+
152156
# test sql query
153157
with pytest.raises(OperationalError):
154158
_ = db.sql_query('notasqlquery', fmt='pandas')
155159
with pytest.raises(OperationalError):
156160
_ = db.sql_query('select * from NotaTable', fmt='pandas')
157161
with pytest.raises(OperationalError):
158162
_ = db.sql_query('select * from Sources where notacolumn == "asdf"', fmt='pandas')
159-
raw_sql_query = db.sql_query('select * from Sources where source == "Luhman 16"', fmt='pandas')
163+
164+
# Using a source that returns a single row
165+
raw_sql_query = db.sql_query('select * from Sources where source == "WISE J104915.57-531906.1"', fmt='pandas')
160166
assert isinstance(raw_sql_query, pd.DataFrame)
167+
168+
# Testing conversion to a markdown string
161169
stringed_results = one_df_query(raw_sql_query)
162170
assert isinstance(stringed_results, str)
163-
return
164171

165172

166173
def test_multi_df_query(db):

simple_app/utils.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,14 +1186,14 @@ def main_utils():
11861186

11871187

11881188
REFERENCE_TABLES = [
1189-
'Publications',
1190-
'Telescopes',
1191-
'Instruments',
1192-
'Modes',
1193-
'PhotometryFilters',
1194-
'Versions',
1195-
'Parameters',
1196-
'Regimes'
1189+
"Publications",
1190+
"Telescopes",
1191+
"Instruments",
1192+
"PhotometryFilters",
1193+
"Versions",
1194+
"Parameters",
1195+
"Regimes",
1196+
"CompanionList"
11971197
]
11981198

11991199
if __name__ == '__main__':

0 commit comments

Comments
 (0)