from datasette.app import Datasette
+import numpy as np
import os
from tables import *
import tempfile
array2 = h5file.create_array(group1, 'array2', [x for x in range(10000)])
+ multiarray = h5file.create_array(group2, 'multi', np.arange(1000).reshape(10, 50, 2))
+
for table in (table1, table2):
row = table.row
assert response.json.keys() == {'test_tables': 0}.keys()
d = response.json['test_tables']
assert d['name'] == 'test_tables'
- assert d['tables_count'] == 4
+ assert d['tables_count'] == 5
def test_database_page(app_client):
response = app_client.get('/test_tables.json', gather_request=False)
'hidden': False,
'fts_table': None,
'foreign_keys': {'incoming': [], 'outgoing': []}
+ }, {
+ 'name': '/group2/multi',
+ 'columns': [],
+ 'primary_keys': [],
+ 'count': 10,
+ 'label_column': None,
+ 'hidden': False,
+ 'fts_table': None,
+ 'foreign_keys': {'incoming': [], 'outgoing': []}
}, {
'name': '/group2/table2',
'columns': ['identity', 'idnumber', 'speed'],
('/test_tables/%2Farray1.json', 2, 1),
('/test_tables/%2Farray1.json?_size=1', 2, 2),
('/test_tables/%2Fgroup1%2Farray2.json?_size=1000', 10000, 10),
+ ('/test_tables/%2Fgroup2%2Fmulti.json?_size=5', 10, 2),
])
def test_paginate_tables_and_arrays(app_client, path, expected_rows, expected_pages):
fetched = []