Skip to content

Commit 20a9d6a

Browse files
Update shell tests to do populations.
1 parent a53f367 commit 20a9d6a

File tree

1 file changed

+38
-29
lines changed

1 file changed

+38
-29
lines changed

shell/tests/test_shell.py

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,26 @@ def spawntable():
104104

105105

106106
@pytest.fixture
107-
def spawntablegen(spawntable):
107+
def spawntablepop(spawntable):
108108
table, c = spawntable
109-
c.sendexpectcmd('.guess dha_cc %s' % (table,))
109+
c.sendexpectcmd('.guess hospitals %s' % (table,))
110110
c.expect_prompt()
111-
return table, 'dha_cc', c
111+
return table, 'hospitals', c
112112

113113

114114
@pytest.fixture
115-
def spawngen(spawntablegen):
116-
table, gen, c = spawntablegen
117-
return gen, c
115+
def spawntablepopgen(spawntablepop):
116+
table, pop, c = spawntablepop
117+
c.sendexpectcmd(
118+
'create generator hospitals_cc for %s using crosscat;' % (pop,))
119+
c.expect_prompt()
120+
return table, pop, 'hospitals_cc', c
121+
122+
123+
@pytest.fixture
124+
def spawnpop(spawntablepop):
125+
table, pop, c = spawntablepop
126+
return pop, c
118127

119128

120129
# Tests begin
@@ -203,10 +212,10 @@ def test_dot_csv_dup(spawnbdb):
203212
c.expect_prompt()
204213

205214

206-
def test_describe_columns_without_generator(spawntable):
215+
def test_describe_columns_without_population(spawntable):
207216
table, c = spawntable
208-
c.sendexpectcmd('.describe columns %s' % (table,))
209-
c.expect_lines(['No such generator: %s' % (repr(table),)])
217+
c.sendexpectcmd('.describe variables %s' % (table,))
218+
c.expect_lines(['No such population: %r' % (table,)])
210219
c.expect_prompt()
211220

212221

@@ -228,7 +237,7 @@ def test_bql_select(spawntable):
228237

229238
def test_guess(spawntable):
230239
table, c = spawntable
231-
c.sendexpectcmd('.guess dha_cc %s' % (table,))
240+
c.sendexpectcmd('.guess hospitals %s' % (table,))
232241
c.expect_prompt()
233242

234243

@@ -252,23 +261,23 @@ def test_sql(spawntable):
252261
c.expect_prompt()
253262

254263

255-
def test_describe_generator(spawntablegen):
256-
table, gen, c = spawntablegen
257-
generator_output = [
258-
'id | name | tabname | metamodel',
259-
'---+--------+---------+----------',
260-
' 1 | dha_cc | dha | crosscat',
264+
def test_describe_population(spawntablepop):
265+
table, pop, c = spawntablepop
266+
population_output = [
267+
'id | name | tabname',
268+
'---+-----------+--------',
269+
' 1 | hospitals | dha',
261270
]
262-
c.sendexpectcmd('.describe generator %s' % (table,))
263-
c.expect_lines(['No such generator: %s' % (repr(table),),])
271+
c.sendexpectcmd('.describe population %s' % (table,))
272+
c.expect_lines(['No such population: %r' % (table,),])
264273
c.expect_prompt()
265-
c.sendexpectcmd('.describe generator %s' % (gen,))
266-
c.expect_lines(generator_output)
274+
c.sendexpectcmd('.describe population %s' % (pop,))
275+
c.expect_lines(population_output)
267276
c.expect_prompt()
268277

269278

270-
def test_describe_models(spawntablegen):
271-
table, gen, c = spawntablegen
279+
def test_describe_models(spawntablepopgen):
280+
table, pop, gen, c = spawntablepopgen
272281
# XXX apsw bug: There is no way to discover the description of a
273282
# cursor that yields no rows. The best we can do without failing
274283
# is to assume that such a cursor has no columns either. This is
@@ -290,9 +299,9 @@ def test_describe_models(spawntablegen):
290299
c.expect_prompt()
291300

292301

293-
def test_describe_column_with_generator(spawntablegen):
294-
table, gen, c = spawntablegen
295-
columns_output = [
302+
def test_describe_column_with_generator(spawntablepopgen):
303+
table, pop, gen, c = spawntablepopgen
304+
variables_output = [
296305
'colno | name | stattype | shortname',
297306
'------+---------------------+-----------+----------',
298307
' 1 | N_DEATH_ILL | numerical | None',
@@ -359,11 +368,11 @@ def test_describe_column_with_generator(spawntablegen):
359368
' 62 | CHF_SCORE | numerical | None',
360369
' 63 | PNEUM_SCORE | numerical | None',
361370
]
362-
c.sendexpectcmd('.describe columns %s' % (table,))
363-
c.expect_lines(['No such generator: %s' % (repr(table),),])
371+
c.sendexpectcmd('.describe variables %s' % (table,))
372+
c.expect_lines(['No such population: %s' % (repr(table),),])
364373
c.expect_prompt()
365-
c.sendexpectcmd('.describe columns %s' % (gen,))
366-
c.expect_lines(columns_output)
374+
c.sendexpectcmd('.describe variables %s' % (pop,))
375+
c.expect_lines(variables_output)
367376
c.expect_prompt()
368377

369378

0 commit comments

Comments
 (0)