@@ -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
@@ -153,20 +162,19 @@ def test_help_returns_list_of_commands(spawnbdb):
153162 c = spawnbdb
154163 c .sendexpectcmd ('.help' )
155164 c .expect_lines ([
156- ' .codebook load codebook for table' ,
157- ' .csv create table from CSV file' ,
158- ' .describe describe BayesDB entities' ,
159- ' .guess guess data generator' ,
160- ' .help show help for commands' ,
161- ' .hook add custom commands from a python source file' ,
162- ' .legacymodels load legacy models' ,
163- ' .open close existing database and open new one' ,
164- ' .pythexec execute a Python statement' ,
165- ' .python evaluate a Python expression' ,
166- ' .read read a file of shell commands' ,
167- ' .sql execute a SQL query' ,
168- ' .trace trace queries' ,
169- ' .untrace untrace queries' ,
165+ ' .codebook load codebook for table' ,
166+ ' .csv create table from CSV file' ,
167+ ' .describe describe BayesDB entities' ,
168+ ' .guess guess population schema' ,
169+ ' .help show help for commands' ,
170+ ' .hook add custom commands from a python source file' ,
171+ ' .open close existing database and open new one' ,
172+ ' .pythexec execute a Python statement' ,
173+ ' .python evaluate a Python expression' ,
174+ ' .read read a file of shell commands' ,
175+ ' .sql execute a SQL query' ,
176+ ' .trace trace queries' ,
177+ ' .untrace untrace queries' ,
170178 "Type `.help <cmd>' for help on the command <cmd>." ,
171179 ])
172180 c .expect_prompt ()
@@ -204,10 +212,10 @@ def test_dot_csv_dup(spawnbdb):
204212 c .expect_prompt ()
205213
206214
207- def test_describe_columns_without_generator (spawntable ):
215+ def test_describe_columns_without_population (spawntable ):
208216 table , c = spawntable
209- c .sendexpectcmd ('.describe columns %s' % (table ,))
210- 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 ,)])
211219 c .expect_prompt ()
212220
213221
@@ -229,7 +237,7 @@ def test_bql_select(spawntable):
229237
230238def test_guess (spawntable ):
231239 table , c = spawntable
232- c .sendexpectcmd ('.guess dha_cc %s' % (table ,))
240+ c .sendexpectcmd ('.guess hospitals %s' % (table ,))
233241 c .expect_prompt ()
234242
235243
@@ -253,23 +261,23 @@ def test_sql(spawntable):
253261 c .expect_prompt ()
254262
255263
256- def test_describe_generator ( spawntablegen ):
257- table , gen , c = spawntablegen
258- generator_output = [
259- 'id | name | tabname | metamodel ' ,
260- '---+--------+ ---------+-- --------' ,
261- ' 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' ,
262270 ]
263- c .sendexpectcmd ('.describe generator %s' % (table ,))
264- 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 ,),])
265273 c .expect_prompt ()
266- c .sendexpectcmd ('.describe generator %s' % (gen ,))
267- c .expect_lines (generator_output )
274+ c .sendexpectcmd ('.describe population %s' % (pop ,))
275+ c .expect_lines (population_output )
268276 c .expect_prompt ()
269277
270278
271- def test_describe_models (spawntablegen ):
272- table , gen , c = spawntablegen
279+ def test_describe_models (spawntablepopgen ):
280+ table , pop , gen , c = spawntablepopgen
273281 # XXX apsw bug: There is no way to discover the description of a
274282 # cursor that yields no rows. The best we can do without failing
275283 # is to assume that such a cursor has no columns either. This is
@@ -291,9 +299,9 @@ def test_describe_models(spawntablegen):
291299 c .expect_prompt ()
292300
293301
294- def test_describe_column_with_generator (spawntablegen ):
295- table , gen , c = spawntablegen
296- columns_output = [
302+ def test_describe_column_with_generator (spawntablepopgen ):
303+ table , pop , gen , c = spawntablepopgen
304+ variables_output = [
297305 'colno | name | stattype | shortname' ,
298306 '------+---------------------+-----------+----------' ,
299307 ' 1 | N_DEATH_ILL | numerical | None' ,
@@ -360,11 +368,11 @@ def test_describe_column_with_generator(spawntablegen):
360368 ' 62 | CHF_SCORE | numerical | None' ,
361369 ' 63 | PNEUM_SCORE | numerical | None' ,
362370 ]
363- c .sendexpectcmd ('.describe columns %s' % (table ,))
364- 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 ),),])
365373 c .expect_prompt ()
366- c .sendexpectcmd ('.describe columns %s' % (gen ,))
367- c .expect_lines (columns_output )
374+ c .sendexpectcmd ('.describe variables %s' % (pop ,))
375+ c .expect_lines (variables_output )
368376 c .expect_prompt ()
369377
370378
@@ -378,21 +386,20 @@ def test_hook(spawnbdb):
378386 c .expect_prompt ()
379387 c .sendexpectcmd ('.help' )
380388 c .expect_lines ([
381- ' .codebook load codebook for table' ,
382- ' .csv create table from CSV file' ,
383- ' .describe describe BayesDB entities' ,
384- ' .guess guess data generator' ,
385- ' .help show help for commands' ,
386- ' .hook add custom commands from a python source file' ,
387- ' .legacymodels load legacy models' ,
388- ' .myhook myhook help string' ,
389- ' .open close existing database and open new one' ,
390- ' .pythexec execute a Python statement' ,
391- ' .python evaluate a Python expression' ,
392- ' .read read a file of shell commands' ,
393- ' .sql execute a SQL query' ,
394- ' .trace trace queries' ,
395- ' .untrace untrace queries' ,
389+ ' .codebook load codebook for table' ,
390+ ' .csv create table from CSV file' ,
391+ ' .describe describe BayesDB entities' ,
392+ ' .guess guess population schema' ,
393+ ' .help show help for commands' ,
394+ ' .hook add custom commands from a python source file' ,
395+ ' .myhook myhook help string' ,
396+ ' .open close existing database and open new one' ,
397+ ' .pythexec execute a Python statement' ,
398+ ' .python evaluate a Python expression' ,
399+ ' .read read a file of shell commands' ,
400+ ' .sql execute a SQL query' ,
401+ ' .trace trace queries' ,
402+ ' .untrace untrace queries' ,
396403 "Type `.help <cmd>' for help on the command <cmd>."
397404 ])
398405 c .expect_prompt ()
0 commit comments