home / code

lines

821 rows where file_id = 10

View and edit SQL

id file_id line_no line
2582 tests/test_html.py 10 1 from bs4 import BeautifulSoup as Soup
2583 tests/test_html.py 10 2 from .fixtures import ( # noqa
2584 tests/test_html.py 10 3 app_client,
2585 tests/test_html.py 10 4 app_client_shorter_time_limit,
2586 tests/test_html.py 10 5 )
2587 tests/test_html.py 10 6 import pytest
2588 tests/test_html.py 10 7 import re
2589 tests/test_html.py 10 8 import urllib.parse
2590 tests/test_html.py 10 9
2591 tests/test_html.py 10 10
2592 tests/test_html.py 10 11 def test_homepage(app_client):
2593 tests/test_html.py 10 12 response = app_client.get('/')
2594 tests/test_html.py 10 13 assert response.status == 200
2595 tests/test_html.py 10 14 assert 'fixtures' in response.text
2596 tests/test_html.py 10 15
2597 tests/test_html.py 10 16
2598 tests/test_html.py 10 17 def test_database_page(app_client):
2599 tests/test_html.py 10 18 response = app_client.get('/fixtures', allow_redirects=False)
2600 tests/test_html.py 10 19 assert response.status == 302
2601 tests/test_html.py 10 20 response = app_client.get('/fixtures')
2602 tests/test_html.py 10 21 assert 'fixtures' in response.text
2603 tests/test_html.py 10 22
2604 tests/test_html.py 10 23
2605 tests/test_html.py 10 24 def test_invalid_custom_sql(app_client):
2606 tests/test_html.py 10 25 response = app_client.get(
2607 tests/test_html.py 10 26 '/fixtures?sql=.schema'
2608 tests/test_html.py 10 27 )
2609 tests/test_html.py 10 28 assert response.status == 400
2610 tests/test_html.py 10 29 assert 'Statement must be a SELECT' in response.text
2611 tests/test_html.py 10 30
2612 tests/test_html.py 10 31
2613 tests/test_html.py 10 32 def test_sql_time_limit(app_client_shorter_time_limit):
2614 tests/test_html.py 10 33 response = app_client_shorter_time_limit.get(
2615 tests/test_html.py 10 34 '/fixtures?sql=select+sleep(0.5)'
2616 tests/test_html.py 10 35 )
2617 tests/test_html.py 10 36 assert 400 == response.status
2618 tests/test_html.py 10 37 expected_html_fragment = """
2619 tests/test_html.py 10 38 <a href="https://datasette.readthedocs.io/en/stable/config.html#sql-time-limit-ms">sql_time_limit_ms</a>
2620 tests/test_html.py 10 39 """.strip()
2621 tests/test_html.py 10 40 assert expected_html_fragment in response.text
2622 tests/test_html.py 10 41
2623 tests/test_html.py 10 42
2624 tests/test_html.py 10 43 def test_row(app_client):
2625 tests/test_html.py 10 44 response = app_client.get(
2626 tests/test_html.py 10 45 '/fixtures/simple_primary_key/1',
2627 tests/test_html.py 10 46 allow_redirects=False
2628 tests/test_html.py 10 47 )
2629 tests/test_html.py 10 48 assert response.status == 302
2630 tests/test_html.py 10 49 assert response.headers['Location'].endswith('/1')
2631 tests/test_html.py 10 50 response = app_client.get('/fixtures/simple_primary_key/1')
2632 tests/test_html.py 10 51 assert response.status == 200
2633 tests/test_html.py 10 52
2634 tests/test_html.py 10 53
2635 tests/test_html.py 10 54 def test_row_strange_table_name(app_client):
2636 tests/test_html.py 10 55 response = app_client.get(
2637 tests/test_html.py 10 56 '/fixtures/table%2Fwith%2Fslashes.csv/3',
2638 tests/test_html.py 10 57 allow_redirects=False
2639 tests/test_html.py 10 58 )
2640 tests/test_html.py 10 59 assert response.status == 302
2641 tests/test_html.py 10 60 assert response.headers['Location'].endswith(
2642 tests/test_html.py 10 61 '/table%2Fwith%2Fslashes.csv/3'
2643 tests/test_html.py 10 62 )
2644 tests/test_html.py 10 63 response = app_client.get('/fixtures/table%2Fwith%2Fslashes.csv/3')
2645 tests/test_html.py 10 64 assert response.status == 200
2646 tests/test_html.py 10 65
2647 tests/test_html.py 10 66
2648 tests/test_html.py 10 67 def test_table_cell_truncation():
2649 tests/test_html.py 10 68 for client in app_client(config={
2650 tests/test_html.py 10 69 "truncate_cells_html": 5,
2651 tests/test_html.py 10 70 }):
2652 tests/test_html.py 10 71 response = client.get("/fixtures/facetable")
2653 tests/test_html.py 10 72 assert response.status == 200
2654 tests/test_html.py 10 73 table = Soup(response.body, "html.parser").find("table")
2655 tests/test_html.py 10 74 assert table["class"] == ["rows-and-columns"]
2656 tests/test_html.py 10 75 assert [
2657 tests/test_html.py 10 76 "Missi…", "Dogpa…", "SOMA", "Tende…", "Berna…", "Hayes…",
2658 tests/test_html.py 10 77 "Holly…", "Downt…", "Los F…", "Korea…", "Downt…", "Greek…",
2659 tests/test_html.py 10 78 "Corkt…", "Mexic…", "Arcad…"
2660 tests/test_html.py 10 79 ] == [
2661 tests/test_html.py 10 80 td.string for td in table.findAll("td", {
2662 tests/test_html.py 10 81 "class": "col-neighborhood"
2663 tests/test_html.py 10 82 })
2664 tests/test_html.py 10 83 ]
2665 tests/test_html.py 10 84
2666 tests/test_html.py 10 85
2667 tests/test_html.py 10 86 def test_row_page_does_not_truncate():
2668 tests/test_html.py 10 87 for client in app_client(config={
2669 tests/test_html.py 10 88 "truncate_cells_html": 5,
2670 tests/test_html.py 10 89 }):
2671 tests/test_html.py 10 90 response = client.get("/fixtures/facetable/1")
2672 tests/test_html.py 10 91 assert response.status == 200
2673 tests/test_html.py 10 92 table = Soup(response.body, "html.parser").find("table")
2674 tests/test_html.py 10 93 assert table["class"] == ["rows-and-columns"]
2675 tests/test_html.py 10 94 assert ["Mission"] == [
2676 tests/test_html.py 10 95 td.string for td in table.findAll("td", {
2677 tests/test_html.py 10 96 "class": "col-neighborhood"
2678 tests/test_html.py 10 97 })
2679 tests/test_html.py 10 98 ]
2680 tests/test_html.py 10 99
2681 tests/test_html.py 10 100

Next page

Advanced export

JSON shape: default, array, object

CSV options:

CREATE TABLE [lines] (
               [id] INTEGER  PRIMARY KEY ,
   [file_id] INTEGER   REFERENCES [files]([id]),
   [line_no] INTEGER  ,
   [line] TEXT  
        )
Powered by Datasette · Query took 7.166ms