code: def test_weird_database_names(tmpdir, filename):
      # https://github.com/simonw/datasette/issues/1181
      runner = CliRunner()
      db_path = str(tmpdir / filename)
      sqlite3.connect(db_path).execute("vacuum")
      result1 = runner.invoke(cli, [db_path, "--get", "/"])
      assert result1.exit_code == 0, result1.output
      filename_no_stem = filename.rsplit(".", 1)[0]
      expected_link = '<a href="/{}">{}</a>'.format(
          tilde_encode(filename_no_stem), filename_no_stem
      )
      assert expected_link in result1.output
      # Now try hitting that database page
      result2 = runner.invoke(
          cli,
          [
              db_path,
              "--get",
              "/{}".format(tilde_encode(filename_no_stem)),
          ],
      )
      assert result2.exit_code == 0, result2.output
  
imports: from .fixtures import app_client, make_app_client, TestClient, EXPECTED_PLUGINS
  import asyncio
  from datasette.app import SETTINGS
  from datasette.plugins import DEFAULT_PLUGINS
  from datasette.cli import cli, serve
  from datasette.version import __version__
  from datasette.utils import tilde_encode
  from datasette.utils.sqlite import sqlite3
  from click.testing import CliRunner
  import io
  import json
  import pathlib
  import pytest
  import sys
  import textwrap
  from unittest import mock
  import urllib
label_desc: Use image node_id 24 for calling a global function with example usage: test_weird_database_names(tmpdir, filename) without return types