repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
redimp/otterwiki | import os
import pytest
from otterwiki.util import (
sha256sum,
sizeof_fmt,
slugify,
split_path,
join_path,
is_valid_email,
empty,
sanitize_pagename,
get_pagepath,
get_page_directoryname,
random_password,
mkdir,
titleSs,
patchset2filedict,
get_header,
strf... | 0 | assert | numeric_literal | tests/test_util.py | test_int_or_None | 278 | null | |
redimp/otterwiki | import bs4
def test_canonical_links(app_with_user, test_client):
# root URL "/" should have canonical pointing to itself (/)
response = test_client.get("/")
assert response.status_code == 200
html = response.data.decode()
soup = bs4.BeautifulSoup(html, "html.parser")
canonical = soup.find("lin... | None | assert | none_literal | tests/test_seo.py | test_canonical_links | 15 | null | |
redimp/otterwiki | import os
import pytest
import tempfile
from pprint import pprint
from otterwiki import gitstorage
def storage(tmpdir):
storage = gitstorage.GitStorage(path=str(tmpdir), initialize=True)
yield storage
def test_empty_log():
with tempfile.TemporaryDirectory() as path:
storage = gitstorage.GitStorag... | [] | assert | collection | tests/test_gitstorage.py | test_empty_log | 367 | null | |
redimp/otterwiki | from bs4 import BeautifulSoup
def get_sidebar_shortcuts(test_client):
"""
Helper function to get all links from the sidebar and the dropdown menu.
"""
rv = test_client.get("/")
assert rv.status_code == 200
soup = BeautifulSoup(rv.data.decode(), "html.parser")
sidebar_menu = soup.find_all("d... | 3 | assert | numeric_literal | tests/test_sidebar.py | test_sidebar_custom_menu_with_separator | 186 | null | |
redimp/otterwiki | from datetime import datetime
from bs4 import BeautifulSoup
def test_admin_form(admin_client):
rv = admin_client.get("/-/admin")
assert rv.status_code == | 200 | assert | numeric_literal | tests/test_preferences.py | test_admin_form | 10 | null | |
redimp/otterwiki | import pytest
import os
import otterwiki.gitstorage
from flask import url_for
def test_home_page_special_page_index(app_with_user, test_client):
original_home_page = app_with_user.config.get("HOME_PAGE")
try:
app_with_user.config["HOME_PAGE"] = "/-/index"
app_with_user.config["READ_ACCESS"] = ... | 302 | assert | numeric_literal | tests/test_home_page.py | test_home_page_special_page_index | 72 | null | |
redimp/otterwiki | from datetime import datetime
from bs4 import BeautifulSoup
def test_preferences_testmail(app_with_user, admin_client):
# workaround since MAIL_SUPPRESS_SEND doesn't work as expected
app_with_user.test_mail.state.suppress = True
# record outbox
with app_with_user.test_mail.record_messages() as outbox:
... | 1 | assert | numeric_literal | tests/test_preferences.py | test_preferences_testmail | 27 | null | |
redimp/otterwiki | import pytest
def test_fatal_error():
from otterwiki import fatal_error
with pytest.raises( | SystemExit) | pytest.raises | variable | tests/test_essentials.py | test_fatal_error | 27 | null | |
redimp/otterwiki | from bs4 import BeautifulSoup
def get_sidebar_shortcuts(test_client):
"""
Helper function to get all links from the sidebar and the dropdown menu.
"""
rv = test_client.get("/")
assert rv.status_code == 200
soup = BeautifulSoup(rv.data.decode(), "html.parser")
sidebar_menu = soup.find_all("d... | "" | assert | string_literal | tests/test_sidebar.py | test_sidebar_custom_menu_backward_compatibility | 208 | null | |
redimp/otterwiki | import pytest
from base64 import b64encode
def create_app_with_git(create_app):
create_app.config["GIT_WEB_SERVER"] = True
yield create_app
create_app.config["GIT_WEB_SERVER"] = False
def test_git_pack(create_app_with_git, test_client_with_git):
create_app_with_git.config["READ_ACCESS"] = "ANONYMOUS"
... | 500 | assert | numeric_literal | tests/test_remote.py | test_git_pack | 114 | null | |
redimp/otterwiki | import os
import pathlib
import re
from io import BytesIO
from flask import url_for
import bs4
import pytest
def _link_by_text(soup, text):
return soup.find("a", string=text)
def save_shortcut(test_client, pagename, content, commit_message):
rv = test_client.post(
"/{}/save".format(pagename),
... | 404 | assert | numeric_literal | tests/test_otterwiki.py | test_view_commit | 263 | null | |
redimp/otterwiki | import pytest
import flask
from datetime import datetime
import otterwiki
import otterwiki.gitstorage
def test_health_check_ok(create_app, req_ctx):
from otterwiki.helper import health_check
healthy, messages = health_check()
assert healthy is True
assert messages == | ["ok"] | assert | collection | tests/test_helper.py | test_health_check_ok | 55 | null | |
redimp/otterwiki | import pytest
def test_fatal_error():
from otterwiki import fatal_error
with pytest.raises(SystemExit) as pytest_wrapped_e:
fatal_error("test_fatal_error")
assert pytest_wrapped_e.type == SystemExit
assert pytest_wrapped_e.value.code == | 1 | assert | numeric_literal | tests/test_essentials.py | test_fatal_error | 30 | null | |
redimp/otterwiki | import os
import pytest
from otterwiki.util import (
sha256sum,
sizeof_fmt,
slugify,
split_path,
join_path,
is_valid_email,
empty,
sanitize_pagename,
get_pagepath,
get_page_directoryname,
random_password,
mkdir,
titleSs,
patchset2filedict,
get_header,
strf... | 16 | assert | numeric_literal | tests/test_util.py | test_random_password | 132 | null | |
redimp/otterwiki | import pytest
import re
from flask import url_for
def login(client):
return client.post(
"/-/login",
data={
"email": "mail@example.org",
"password": "password1234",
},
follow_redirects=True,
)
def app_with_permissions(app_with_user, test_client):
app... | 200 | assert | numeric_literal | tests/test_auth.py | test_page_view_permissions | 224 | null | |
redimp/otterwiki | import pytest
class TestHousekeepingEmptyPages:
def test_housekeeping_empty_pages_permissions(
self, app_with_user, other_client
):
"""Test that users without WRITE permission cannot access empty pages scan."""
original_write_access = app_with_user.config["WRITE_ACCESS"]
try:
... | 403 | assert | numeric_literal | tests/test_housekeeping.py | test_housekeeping_empty_pages_permissions | TestHousekeepingEmptyPages | 129 | null |
redimp/otterwiki | import re
import bs4
import json
from urllib.parse import unquote
def test_urlquote(test_client):
for pagename in [
"Example",
"Example with space",
"ExampleWith\"Doublequote",
"Example'SingleQuote'",
"Example_",
"Example-Example",
"Example_Example",
... | pagename | assert | variable | tests/test_editor.py | test_urlquote | 39 | null | |
redimp/otterwiki | import pytest
import os
import tempfile
def test_custom_html(test_client, create_app):
"""Test that custom HTML works with HTML_EXTRA_HEAD, HTML_EXTRA_BODY and custom files"""
app = create_app
app.config['HTML_EXTRA_HEAD'] = (
'<meta name="env-head" content="env-head-value">'
)
app.config[... | html | assert | variable | tests/test_custom_html.py | test_custom_html | 50 | null | |
redimp/otterwiki | from xml.etree.ElementTree import fromstring
from bs4 import BeautifulSoup
def test_sitemap(admin_client):
"""Test sitemap generation and XML validity."""
response = admin_client.get("/sitemap.xml")
assert response.status_code == | 200 | assert | numeric_literal | tests/test_sitemap.py | test_sitemap | 11 | null | |
redimp/otterwiki | import pytest
from base64 import b64encode
def create_app_with_git(create_app):
create_app.config["GIT_WEB_SERVER"] = True
yield create_app
create_app.config["GIT_WEB_SERVER"] = False
def test_git_info_refs(create_app_with_git, test_client_with_git):
create_app_with_git.config["READ_ACCESS"] = "ANONYM... | 200 | assert | numeric_literal | tests/test_remote.py | test_git_info_refs | 48 | null | |
redimp/otterwiki | import pytest
import base64
from flask import url_for
def app_with_attachments(create_app):
# create test page
message = "Test.md commit"
filename = "test.md"
author = ("Example Author", "mail@example.com")
# create attachment
create_app.storage.store(
filename,
content="# Test\... | response.data.decode() | assert | func_call | tests/test_attachments.py | test_list_attachments | 61 | null | |
redimp/otterwiki | import os
import pathlib
import re
from io import BytesIO
from flask import url_for
import bs4
import pytest
def _link_by_text(soup, text):
return soup.find("a", string=text)
def save_shortcut(test_client, pagename, content, commit_message):
rv = test_client.post(
"/{}/save".format(pagename),
... | 200 | assert | numeric_literal | tests/test_otterwiki.py | save_shortcut | 153 | null | |
redimp/otterwiki | import pytest
import os
import otterwiki.gitstorage
from flask import url_for
def create_app_with_home_page_env(tmpdir):
"""Create app with HOME_PAGE set via environment variable before initialization."""
original_home_page = os.environ.get("HOME_PAGE")
original_settings = os.environ.get("OTTERWIKI_SETTING... | content | assert | variable | tests/test_home_page.py | test_initialization_with_default_home_page | 270 | null | |
redimp/otterwiki | import pytest
import flask
from datetime import datetime
import otterwiki
import otterwiki.gitstorage
def create_app_raw_filenames(create_app):
create_app.config["RETAIN_PAGE_NAME_CASE"] = True
yield create_app
create_app.config["RETAIN_PAGE_NAME_CASE"] = False
def test_get_pagename_prefixes(test_client):... | 200 | assert | numeric_literal | tests/test_helper.py | test_get_pagename_prefixes | 251 | null | |
redimp/otterwiki | import pytest
import re
from flask import url_for
def login(client):
return client.post(
"/-/login",
data={
"email": "mail@example.org",
"password": "password1234",
},
follow_redirects=True,
)
def app_with_permissions(app_with_user, test_client):
app... | 0 | assert | numeric_literal | tests/test_auth.py | test_user_with_empty_password_issues_204_205 | 811 | null | |
redimp/otterwiki | from bs4 import BeautifulSoup
def get_sidebar_shortcuts(test_client):
"""
Helper function to get all links from the sidebar and the dropdown menu.
"""
rv = test_client.get("/")
assert rv.status_code == 200
soup = BeautifulSoup(rv.data.decode(), "html.parser")
sidebar_menu = soup.find_all("d... | 1 | assert | numeric_literal | tests/test_sidebar.py | get_sidebar_shortcuts | 15 | null | |
redimp/otterwiki | from xml.etree.ElementTree import fromstring
from bs4 import BeautifulSoup
def test_sitemap(admin_client):
"""Test sitemap generation and XML validity."""
response = admin_client.get("/sitemap.xml")
assert response.status_code == 200
assert response.headers['Content-Type'] == | 'application/xml; charset=utf-8' | assert | string_literal | tests/test_sitemap.py | test_sitemap | 12 | null | |
redimp/otterwiki | import pytest
from base64 import b64encode
def create_app_with_git(create_app):
create_app.config["GIT_WEB_SERVER"] = True
yield create_app
create_app.config["GIT_WEB_SERVER"] = False
def test_git_info_refs(create_app_with_git, test_client_with_git):
create_app_with_git.config["READ_ACCESS"] = "ANONYM... | 400 | assert | numeric_literal | tests/test_remote.py | test_git_info_refs | 59 | null | |
redimp/otterwiki | import pytest
from base64 import b64encode
def create_app_with_git(create_app):
create_app.config["GIT_WEB_SERVER"] = True
yield create_app
create_app.config["GIT_WEB_SERVER"] = False
def test_git_info_refs_404(create_app, test_client):
rv = test_client.get(
"/.git/info/refs?service=git-upload... | 404 | assert | numeric_literal | tests/test_remote.py | test_git_info_refs_404 | 26 | null | |
redimp/otterwiki | import os
import pytest
from otterwiki.util import (
sha256sum,
sizeof_fmt,
slugify,
split_path,
join_path,
is_valid_email,
empty,
sanitize_pagename,
get_pagepath,
get_page_directoryname,
random_password,
mkdir,
titleSs,
patchset2filedict,
get_header,
strf... | "" | assert | string_literal | tests/test_util.py | test_slugigy | 38 | null | |
redimp/otterwiki | import pytest
import os
import tempfile
def test_load_custom_html_nonexistent_file(create_app):
"""Test loading a non-existent custom HTML file returns empty string"""
app = create_app
from otterwiki.helper import load_custom_html
with app.app_context():
result = load_custom_html('nonexistent... | "" | assert | string_literal | tests/test_custom_html.py | test_load_custom_html_nonexistent_file | 17 | null | |
redimp/otterwiki | import bs4
def test_meta_description_uses_site_description(test_client, create_app):
test_description = "This is a test wiki"
create_app.config["SITE_DESCRIPTION"] = test_description
response = test_client.get("/")
assert response.status_code == 200
html = response.data.decode()
soup = bs4.Bea... | test_description | assert | variable | tests/test_seo.py | test_meta_description_uses_site_description | 110 | null | |
redimp/otterwiki | from test_auth import login
def create_draft(test_client, pagepath, content):
cursor_line = "1"
cursor_ch = "2"
rv = test_client.post(
"/{}/draft".format(pagepath),
data={
"content": content,
"cursor_line": cursor_line,
"cursor_ch": cursor_ch,
},
... | html.lower() | assert | func_call | tests/test_draft.py | test_draft_warning | 66 | null | |
redimp/otterwiki | import pytest
import os
import otterwiki.gitstorage
from datetime import datetime
def create_app(tmpdir):
tmpdir.mkdir("repo")
_storage = otterwiki.gitstorage.GitStorage(
path=str(tmpdir.join("repo")), initialize=True
)
settings_cfg = str(tmpdir.join("settings.cfg"))
# write config file
... | html | assert | variable | tests/conftest.py | admin_client | 107 | null | |
redimp/otterwiki | from xml.etree.ElementTree import fromstring
from bs4 import BeautifulSoup
def test_home_page_sitemap_default(app_with_user, test_client):
"""Test sitemap generation with default home page."""
app_with_user.config["HOME_PAGE"] = ""
app_with_user.config["READ_ACCESS"] = "ANONYMOUS"
# Create pages
t... | 1 | assert | numeric_literal | tests/test_sitemap.py | test_home_page_sitemap_default | 51 | null | |
redimp/otterwiki | import pytest
from bs4 import BeautifulSoup
from otterwiki.renderer import (
render,
clean_html,
OtterwikiRenderer,
pygments_render,
)
def test_nested_list():
md = """# Nested lists
1. A
- B
- C
2. D
"""
html, _, _ = render.markdown(md)
ol = BeautifulSoup(html, "html.parser").find('... | 4 | assert | numeric_literal | tests/test_renderer.py | test_nested_list | 867 | null | |
redimp/otterwiki | import re
from otterwiki.plugins import hookimpl, plugin_manager
def test_noemoji():
noemoji = NoEmojiPlugin()
assert noemoji.preprocess_markdown("👴") == "" | "" | assert | string_literal | docs/plugin_examples/plugin_noemojis/otterwiki_noemojis.py | test_noemoji | 50 | null | |
redimp/otterwiki | import os
import pytest
from otterwiki.util import (
sha256sum,
sizeof_fmt,
slugify,
split_path,
join_path,
is_valid_email,
empty,
sanitize_pagename,
get_pagepath,
get_page_directoryname,
random_password,
mkdir,
titleSs,
patchset2filedict,
get_header,
strf... | "abc" | assert | string_literal | tests/test_util.py | test_slugigy | 39 | null | |
redimp/otterwiki | import pytest
import os
import otterwiki.gitstorage
from flask import url_for
def test_home_page_default(app_with_user, test_client):
original_home_page = app_with_user.config.get("HOME_PAGE")
try:
app_with_user.config["HOME_PAGE"] = ""
app_with_user.config["READ_ACCESS"] = "ANONYMOUS"
... | html | assert | variable | tests/test_home_page.py | test_home_page_default | 40 | null | |
redimp/otterwiki | import os
import pytest
from otterwiki.util import (
sha256sum,
sizeof_fmt,
slugify,
split_path,
join_path,
is_valid_email,
empty,
sanitize_pagename,
get_pagepath,
get_page_directoryname,
random_password,
mkdir,
titleSs,
patchset2filedict,
get_header,
strf... | "a-b" | assert | string_literal | tests/test_util.py | test_slugigy | 41 | null | |
redimp/otterwiki | import pytest
def test_robots(test_client):
response = test_client.get("/robots.txt")
assert response.status_code == 200
assert "User-agent: *\nAllow: /" in | response.data.decode() | assert | func_call | tests/test_essentials.py | test_robots | 10 | null | |
redimp/otterwiki | from xml.etree.ElementTree import fromstring
from bs4 import BeautifulSoup
def test_sitemap(admin_client):
"""Test sitemap generation and XML validity."""
response = admin_client.get("/sitemap.xml")
assert response.status_code == 200
assert response.headers['Content-Type'] == 'application/xml; charset=... | '{http://www.sitemaps.org/schemas/sitemap/0.9}urlset' | assert | string_literal | tests/test_sitemap.py | test_sitemap | 14 | null | |
redimp/otterwiki | import pytest
import re
from flask import url_for
def login(client):
return client.post(
"/-/login",
data={
"email": "mail@example.org",
"password": "password1234",
},
follow_redirects=True,
)
def app_with_permissions(app_with_user, test_client):
app... | 302 | assert | numeric_literal | tests/test_auth.py | test_page_blame_permissions | 239 | null | |
redimp/otterwiki | import pytest
import flask
from datetime import datetime
import otterwiki
import otterwiki.gitstorage
def create_app_raw_filenames(create_app):
create_app.config["RETAIN_PAGE_NAME_CASE"] = True
yield create_app
create_app.config["RETAIN_PAGE_NAME_CASE"] = False
def test_auto_url_raw(create_app_raw_filenam... | "home" | assert | string_literal | tests/test_helper.py | test_auto_url_raw | 118 | null | |
redimp/otterwiki | import os
import pytest
import tempfile
from pprint import pprint
from otterwiki import gitstorage
def storage(tmpdir):
storage = gitstorage.GitStorage(path=str(tmpdir), initialize=True)
yield storage
def test_revert_fail(storage):
author = ("Example Author", "mail@example.com")
filename = "test_reve... | files | assert | variable | tests/test_gitstorage.py | test_revert_fail | 136 | null | |
redimp/otterwiki | import os
import pytest
from otterwiki.util import (
sha256sum,
sizeof_fmt,
slugify,
split_path,
join_path,
is_valid_email,
empty,
sanitize_pagename,
get_pagepath,
get_page_directoryname,
random_password,
mkdir,
titleSs,
patchset2filedict,
get_header,
strf... | 1 | assert | numeric_literal | tests/test_util.py | test_patchset2filedict | 187 | null | |
redimp/otterwiki | import re
from flask import url_for
def save_shortcut(test_client, pagename, content, commit_message):
"""Helper function to save a page"""
rv = test_client.post(
"/{}/save".format(pagename),
data={
"content": content,
"commit": commit_message,
},
follow_... | 6 | assert | numeric_literal | tests/test_history.py | test_page_history_links_after_rename | 101 | null | |
redimp/otterwiki | import re
from otterwiki.plugins import hookimpl, plugin_manager
def test_noemoji():
noemoji = NoEmojiPlugin()
assert noemoji.preprocess_markdown("👴") == ""
assert ( | "Hello, World!" | assert | string_literal | docs/plugin_examples/plugin_noemojis/otterwiki_noemojis.py | test_noemoji | 51 | null | |
redimp/otterwiki | import pytest
class TestHousekeepingEmptyPages:
def test_housekeeping_empty_pages_scan(self, app_with_user, admin_client):
"""Test scanning for empty pages."""
from otterwiki.server import storage
from otterwiki.helper import get_filename
empty_pagepath = "test_empty_page"
... | 200 | assert | numeric_literal | tests/test_housekeeping.py | test_housekeeping_empty_pages_scan | TestHousekeepingEmptyPages | 44 | null |
redimp/otterwiki | import os
import pathlib
import re
from io import BytesIO
from flask import url_for
import bs4
import pytest
def _link_by_text(soup, text):
return soup.find("a", string=text)
def save_shortcut(test_client, pagename, content, commit_message):
rv = test_client.post(
"/{}/save".format(pagename),
... | 2 | assert | numeric_literal | tests/test_otterwiki.py | test_view_revision | 237 | null | |
redimp/otterwiki | import os
import pytest
from otterwiki.util import (
sha256sum,
sizeof_fmt,
slugify,
split_path,
join_path,
is_valid_email,
empty,
sanitize_pagename,
get_pagepath,
get_page_directoryname,
random_password,
mkdir,
titleSs,
patchset2filedict,
get_header,
strf... | 10 | assert | numeric_literal | tests/test_util.py | test_int_or_None | 270 | null | |
redimp/otterwiki | from test_auth import login
def create_draft(test_client, pagepath, content):
cursor_line = "1"
cursor_ch = "2"
rv = test_client.post(
"/{}/draft".format(pagepath),
data={
"content": content,
"cursor_line": cursor_line,
"cursor_ch": cursor_ch,
},
... | html | assert | variable | tests/test_draft.py | test_draft_warning | 77 | null | |
redimp/otterwiki | from datetime import datetime
from bs4 import BeautifulSoup
def test_update_preferences(app_with_user, admin_client):
new_name = "Test Wiki 4711"
new_description = "another Test Wiki 4711"
new_server_name = "test_host"
assert app_with_user.config['SITE_NAME'] != new_name
assert app_with_user.config... | "" | assert | string_literal | tests/test_preferences.py | test_update_preferences | 79 | null | |
redimp/otterwiki | import pytest
import flask
from datetime import datetime
import otterwiki
import otterwiki.gitstorage
def test_toast_session(create_app, req_ctx, test_client):
test_string = "aa bb cc dd"
from otterwiki.helper import toast
from flask import session
html = test_client.get("/").data.decode()
assert... | html | assert | variable | tests/test_helper.py | test_toast_session | 28 | null | |
redimp/otterwiki | from datetime import datetime
from bs4 import BeautifulSoup
def test_preferences_403(app_with_user, other_client):
rv = other_client.get(
"/-/admin/sidebar_preferences", follow_redirects=True
)
assert rv.status_code == | 403 | assert | numeric_literal | tests/test_preferences.py | test_preferences_403 | 266 | null | |
redimp/otterwiki | import pytest
class TestHousekeepingBrokenWikilinks:
def test_housekeeping_broken_wikilinks_tables_structure(
self, app_with_user, admin_client
):
"""Test that both tables are displayed with correct structure."""
from otterwiki.server import storage
from otterwiki.helper import... | html | assert | variable | tests/test_housekeeping.py | test_housekeeping_broken_wikilinks_tables_structure | TestHousekeepingBrokenWikilinks | 199 | null |
redimp/otterwiki | import os
import pytest
import tempfile
from pprint import pprint
from otterwiki import gitstorage
def storage(tmpdir):
storage = gitstorage.GitStorage(path=str(tmpdir), initialize=True)
yield storage
def test_ascii_binary(storage):
content = "kdfjlhg gdklfjghdf gkl;djshfg dgf;lkjhs glkshjad"
message... | str | assert | variable | tests/test_gitstorage.py | test_ascii_binary | 160 | null | |
redimp/otterwiki | import bs4
import re
from otterwiki.renderer import render
markdown_example = """# Header
Bla Bla.
```bash
WORLD="World"
echo "Hello $WORLD"
```
- a
- b
- c
1. one
2. two
3. three
| column1 | column2 |
|---------|---------|
| row11 | row21 |
| row12 | row22 |
| row13 | row23 |
Inline math: `$a^2+b^2=... | soup.text | assert | complex_expr | tests/test_preview.py | test_preview_cursor_in_abbr | 174 | null | |
redimp/otterwiki | from test_auth import login
def create_draft(test_client, pagepath, content):
cursor_line = "1"
cursor_ch = "2"
rv = test_client.post(
"/{}/draft".format(pagepath),
data={
"content": content,
"cursor_line": cursor_line,
"cursor_ch": cursor_ch,
},
... | "draft saved" | assert | string_literal | tests/test_draft.py | create_draft | 19 | null | |
redimp/otterwiki | import os
import tempfile
import hashlib
from unittest.mock import patch, MagicMock
from bs4 import BeautifulSoup
import pytest
TEST_REMOTE_URL = "git@github.com:test/repo.git"
TEST_PRIVATE_KEY = "-----BEGIN OPENSSH PRIVATE KEY-----\ntest_key_content\n-----END OPENSSH PRIVATE KEY-----"
ADMIN_REPO_MGMT_URL = "/-/admin/... | "" | assert | string_literal | tests/test_repository_management.py | test_ssh_key_cleared_when_disabled | TestGitRemotePush | 218 | null |
redimp/otterwiki | import pytest
import re
from flask import url_for
def test_db(app_with_user):
from otterwiki.auth import SimpleAuth, check_password_hash, db
# check that table 'user' exists
from sqlalchemy import inspect
inspector = inspect(db.engine)
assert "user" in [str(x) for x in inspector.get_table_names()... | 2 | assert | numeric_literal | tests/test_auth.py | test_db | 28 | null | |
redimp/otterwiki | import bs4
import re
from otterwiki.renderer import render
markdown_example = """# Header
Bla Bla.
```bash
WORLD="World"
echo "Hello $WORLD"
```
- a
- b
- c
1. one
2. two
3. three
| column1 | column2 |
|---------|---------|
| row11 | row21 |
| row12 | row22 |
| row13 | row23 |
Inline math: `$a^2+b^2=... | text | assert | variable | tests/test_preview.py | test_preview_italic_bug | 134 | null | |
redimp/otterwiki | import os
import pytest
import tempfile
from pprint import pprint
from otterwiki import gitstorage
def storage(tmpdir):
storage = gitstorage.GitStorage(path=str(tmpdir), initialize=True)
yield storage
def test_list(storage):
msg, content = "Test commit", "Lore ipsum"
author = ("Example Author", "mail... | ["c"] | assert | collection | tests/test_gitstorage.py | test_list | 264 | null | |
redimp/otterwiki | import pytest
import os
import re
import otterwiki
from pprint import pprint
def test_settings_update_name(app_with_user, test_client):
rv = test_client.post(
"/-/login",
data={
"email": "mail@example.org",
"password": "password1234",
},
follow_redirects=True... | rv.data.decode() | assert | func_call | tests/test_settings.py | test_settings_update_name | 25 | null | |
redimp/otterwiki | import pytest
import base64
from flask import url_for
def app_with_attachments(create_app):
# create test page
message = "Test.md commit"
filename = "test.md"
author = ("Example Author", "mail@example.com")
# create attachment
create_app.storage.store(
filename,
content="# Test\... | 200 | assert | numeric_literal | tests/test_attachments.py | test_app_with_attachments | 55 | null | |
redimp/otterwiki | import os
import pytest
from otterwiki.util import (
sha256sum,
sizeof_fmt,
slugify,
split_path,
join_path,
is_valid_email,
empty,
sanitize_pagename,
get_pagepath,
get_page_directoryname,
random_password,
mkdir,
titleSs,
patchset2filedict,
get_header,
strf... | "😊" | assert | string_literal | tests/test_util.py | test_sanitize_pagename | 118 | null | |
redimp/otterwiki | from bs4 import BeautifulSoup
def get_sidebar_shortcuts(test_client):
"""
Helper function to get all links from the sidebar and the dropdown menu.
"""
rv = test_client.get("/")
assert rv.status_code == 200
soup = BeautifulSoup(rv.data.decode(), "html.parser")
sidebar_menu = soup.find_all("d... | None | assert | none_literal | tests/test_sidebar.py | test_sidebar_custom_menu | 112 | null | |
redimp/otterwiki | import pytest
from bs4 import BeautifulSoup
from otterwiki.renderer import (
render,
clean_html,
OtterwikiRenderer,
pygments_render,
)
def test_nested_list():
md = """# Nested lists
1. A
- B
- C
2. D
"""
html, _, _ = render.markdown(md)
ol = BeautifulSoup(html, "html.parser").find('... | 2 | assert | numeric_literal | tests/test_renderer.py | test_nested_list | 871 | null | |
redimp/otterwiki | import os
import pytest
from otterwiki.util import (
sha256sum,
sizeof_fmt,
slugify,
split_path,
join_path,
is_valid_email,
empty,
sanitize_pagename,
get_pagepath,
get_page_directoryname,
random_password,
mkdir,
titleSs,
patchset2filedict,
get_header,
strf... | x | assert | variable | tests/test_util.py | test_split_and_join_path | 69 | null | |
redimp/otterwiki | from test_auth import login
def create_draft(test_client, pagepath, content):
cursor_line = "1"
cursor_ch = "2"
rv = test_client.post(
"/{}/draft".format(pagepath),
data={
"content": content,
"cursor_line": cursor_line,
"cursor_ch": cursor_ch,
},
... | 200 | assert | numeric_literal | tests/test_draft.py | create_draft | 18 | null | |
redimp/otterwiki | from test_auth import login
def create_draft(test_client, pagepath, content):
cursor_line = "1"
cursor_ch = "2"
rv = test_client.post(
"/{}/draft".format(pagepath),
data={
"content": content,
"cursor_line": cursor_line,
"cursor_ch": cursor_ch,
},
... | 1 | assert | numeric_literal | tests/test_draft.py | test_create_draft | 35 | null | |
drivendataorg/erdantic | import builtins
import dataclasses
import filecmp
import os
from pathlib import Path
import sys
from typing import Annotated, Any, AnyStr, List, Literal, Optional, Tuple, TypeVar
import IPython.lib.pretty as IPython_pretty
import pydantic
import pytest
import rich
from erdantic.core import (
Edge,
EntityRelat... | model2 | assert | variable | tests/test_core.py | test_equality | 153 | null | |
drivendataorg/erdantic | from pprint import pprint
from typing import Optional
from attrs import define, resolve_types
import pytest
from erdantic.core import EntityRelationshipDiagram, FullyQualifiedName
import erdantic.examples.attrs as attrs_examples
from erdantic.exceptions import UnresolvableForwardRefError
from erdantic.plugins.attrs i... | "GlobalOtherClassBefore" | assert | string_literal | tests/test_attrs.py | test_forward_refs_fn_scope_auto_resolvable | 124 | null | |
drivendataorg/erdantic | from pprint import pprint
import sys
from typing import Optional
import pydantic
import pydantic.v1
import pytest
from erdantic.core import EntityRelationshipDiagram, FullyQualifiedName
import erdantic.examples.pydantic as pydantic_examples
from erdantic.exceptions import UnresolvableForwardRefError
def test_forward... | "Optional[Quest]" | assert | string_literal | tests/test_pydantic_v1.py | test_forward_refs_global_scope | 98 | null | |
drivendataorg/erdantic | from pprint import pprint
from typing import Optional
from attrs import define, resolve_types
import pytest
from erdantic.core import EntityRelationshipDiagram, FullyQualifiedName
import erdantic.examples.attrs as attrs_examples
from erdantic.exceptions import UnresolvableForwardRefError
from erdantic.plugins.attrs i... | GlobalOtherClassBefore | assert | variable | tests/test_attrs.py | test_forward_refs_fn_scope_auto_resolvable | 125 | null | |
drivendataorg/erdantic | import subprocess
import sys
import textwrap
import pytest
import erdantic.examples
from erdantic.exceptions import PluginNotFoundError
from erdantic.plugins import (
get_field_extractor_fn,
get_predicate_fn,
identify_field_extractor_fn,
list_plugins,
)
import erdantic.plugins.attrs
import erdantic.pl... | get_fields_fn | assert | variable | tests/test_plugins.py | test_register_plugin | 29 | null | |
drivendataorg/erdantic | from pprint import pprint
import sys
from typing import Optional
import pydantic
import pydantic.v1
import pytest
from erdantic.core import EntityRelationshipDiagram, FullyQualifiedName
import erdantic.examples.pydantic as pydantic_examples
from erdantic.exceptions import UnresolvableForwardRefError
def test_forward... | "FnScopeOtherModelAfter" | assert | string_literal | tests/test_pydantic_v1.py | test_forward_refs_fn_scope_manual_resolvable | 195 | null | |
drivendataorg/erdantic | import erdantic as erd
from erdantic.core import Cardinality, Modality
from erdantic.d2 import (
_get_crowsfoot_d2,
_get_visibility_prefix,
_maybe_quote_value,
_quote_identifier,
render_d2,
)
from erdantic.examples import pydantic
def test_identifier_and_value_quoting():
"""Identifiers are alwa... | '"list[Item]"' | assert | string_literal | tests/test_d2.py | test_identifier_and_value_quoting | 49 | null | |
drivendataorg/erdantic | import erdantic as erd
from erdantic.core import Cardinality, Modality
from erdantic.d2 import (
_get_crowsfoot_d2,
_get_visibility_prefix,
_maybe_quote_value,
_quote_identifier,
render_d2,
)
from erdantic.examples import pydantic
def test_identifier_and_value_quoting():
"""Identifiers are alwa... | '"ValidName"' | assert | string_literal | tests/test_d2.py | test_identifier_and_value_quoting | 46 | null | |
drivendataorg/erdantic | from pprint import pprint
from typing import Optional
import msgspec
import pytest
from erdantic.core import EntityRelationshipDiagram, FullyQualifiedName
import erdantic.examples.msgspec as msgspec_examples
from erdantic.exceptions import UnresolvableForwardRefError
from erdantic.plugins.msgspec import (
get_fie... | "datetime" | assert | string_literal | tests/test_msgspec.py | test_get_fields_from_msgspec_struct | 41 | null | |
drivendataorg/erdantic | from pprint import pprint
import sys
from typing import Optional
import pydantic
import pytest
from erdantic.core import EntityRelationshipDiagram, FullyQualifiedName
import erdantic.examples.pydantic as pydantic_examples
from erdantic.exceptions import UnresolvableForwardRefError
from erdantic.plugins.pydantic impor... | FnScopeOtherModelAfter | assert | variable | tests/test_pydantic.py | test_forward_refs_fn_scope_manual_resolvable | 186 | null | |
drivendataorg/erdantic | from pprint import pprint
from typing import Optional
from attrs import define, resolve_types
import pytest
from erdantic.core import EntityRelationshipDiagram, FullyQualifiedName
import erdantic.examples.attrs as attrs_examples
from erdantic.exceptions import UnresolvableForwardRefError
from erdantic.plugins.attrs i... | "name" | assert | string_literal | tests/test_attrs.py | test_get_fields_from_attrs_class | 36 | null | |
drivendataorg/erdantic | import dataclasses
from dataclasses import dataclass
from pprint import pprint
from typing import Annotated, Optional, get_type_hints
import pytest
from erdantic.core import EntityRelationshipDiagram, FullyQualifiedName
import erdantic.examples.dataclasses as dataclasses_examples
from erdantic.exceptions import Unres... | 1 | assert | numeric_literal | tests/test_dataclasses.py | test_annotated | 200 | null | |
drivendataorg/erdantic | import builtins
import dataclasses
import filecmp
import os
from pathlib import Path
import sys
from typing import Annotated, Any, AnyStr, List, Literal, Optional, Tuple, TypeVar
import IPython.lib.pretty as IPython_pretty
import pydantic
import pytest
import rich
from erdantic.core import (
Edge,
EntityRelat... | Party | assert | variable | tests/test_core.py | test_fully_qualified_name_import_object | 40 | null | |
drivendataorg/erdantic | from pprint import pprint
from typing import Optional
import msgspec
import pytest
from erdantic.core import EntityRelationshipDiagram, FullyQualifiedName
import erdantic.examples.msgspec as msgspec_examples
from erdantic.exceptions import UnresolvableForwardRefError
from erdantic.plugins.msgspec import (
get_fie... | GlobalWithFwdRefs | assert | variable | tests/test_msgspec.py | test_forward_refs_global_scope | 91 | null | |
drivendataorg/erdantic | import erdantic as erd
from erdantic.core import Cardinality, Modality
from erdantic.d2 import (
_get_crowsfoot_d2,
_get_visibility_prefix,
_maybe_quote_value,
_quote_identifier,
render_d2,
)
from erdantic.examples import pydantic
def test_identifier_and_value_quoting():
"""Identifiers are alwa... | '"Foo | None"' | assert | string_literal | tests/test_d2.py | test_identifier_and_value_quoting | 50 | null | |
drivendataorg/erdantic | from pprint import pprint
import sys
from typing import Optional
import pydantic
import pydantic.v1
import pytest
from erdantic.core import EntityRelationshipDiagram, FullyQualifiedName
import erdantic.examples.pydantic as pydantic_examples
from erdantic.exceptions import UnresolvableForwardRefError
def test_get_fie... | "name" | assert | string_literal | tests/test_pydantic_v1.py | test_get_fields_from_pydantic_v1_model | 44 | null | |
drivendataorg/erdantic | import dataclasses
from dataclasses import dataclass
from pprint import pprint
from typing import Annotated, Optional, get_type_hints
import pytest
from erdantic.core import EntityRelationshipDiagram, FullyQualifiedName
import erdantic.examples.dataclasses as dataclasses_examples
from erdantic.exceptions import Unres... | "datetime" | assert | string_literal | tests/test_dataclasses.py | test_get_fields_from_dataclass | 43 | null | |
drivendataorg/erdantic | import typing
import pytest
from erdantic.exceptions import _UnevaluatedForwardRefError
from erdantic.typing_utils import (
get_depth1_bases,
get_recursive_args,
is_collection_type_of,
is_nullable_type,
repr_type_with_mro,
)
def test_repr_type_with_mro():
class FancyInt(int):
pass
... | "<mro (tests.test_typing_utils.test_repr_type_with_mro.<locals>.FancyInt, int, object)>" | assert | string_literal | tests/test_typing_utils.py | test_repr_type_with_mro | 104 | null | |
drivendataorg/erdantic | from pprint import pprint
from typing import Optional
import msgspec
import pytest
from erdantic.core import EntityRelationshipDiagram, FullyQualifiedName
import erdantic.examples.msgspec as msgspec_examples
from erdantic.exceptions import UnresolvableForwardRefError
from erdantic.plugins.msgspec import (
get_fie... | "name" | assert | string_literal | tests/test_msgspec.py | test_get_fields_from_msgspec_struct | 36 | null | |
drivendataorg/erdantic | from pprint import pprint
import sys
from typing import Optional
import pydantic
import pydantic.v1
import pytest
from erdantic.core import EntityRelationshipDiagram, FullyQualifiedName
import erdantic.examples.pydantic as pydantic_examples
from erdantic.exceptions import UnresolvableForwardRefError
def test_get_fie... | "members" | assert | string_literal | tests/test_pydantic_v1.py | test_get_fields_from_pydantic_v1_model | 52 | null | |
drivendataorg/erdantic | import erdantic as erd
from erdantic.core import Cardinality, Modality
from erdantic.d2 import (
_get_crowsfoot_d2,
_get_visibility_prefix,
_maybe_quote_value,
_quote_identifier,
render_d2,
)
from erdantic.examples import pydantic
def test_get_visibility_prefix():
"""Test visibility prefix dete... | "+" | assert | string_literal | tests/test_d2.py | test_get_visibility_prefix | 39 | null | |
drivendataorg/erdantic | import erdantic as erd
from erdantic.core import Cardinality, Modality
from erdantic.d2 import (
_get_crowsfoot_d2,
_get_visibility_prefix,
_maybe_quote_value,
_quote_identifier,
render_d2,
)
from erdantic.examples import pydantic
def test_render_d2():
"""Test full D2 rendering."""
diagram ... | d2_string | assert | variable | tests/test_d2.py | test_render_d2 | 19 | null | |
drivendataorg/erdantic | from pprint import pprint
from typing import Optional
import msgspec
import pytest
from erdantic.core import EntityRelationshipDiagram, FullyQualifiedName
import erdantic.examples.msgspec as msgspec_examples
from erdantic.exceptions import UnresolvableForwardRefError
from erdantic.plugins.msgspec import (
get_fie... | GlobalOtherClassBefore | assert | variable | tests/test_msgspec.py | test_forward_refs_fn_scope_auto_resolvable | 121 | null | |
drivendataorg/erdantic | from pprint import pprint
import sys
from typing import Optional
import pydantic
import pydantic.v1
import pytest
from erdantic.core import EntityRelationshipDiagram, FullyQualifiedName
import erdantic.examples.pydantic as pydantic_examples
from erdantic.exceptions import UnresolvableForwardRefError
def test_forward... | Optional[FnScopeOtherModelAfter] | assert | complex_expr | tests/test_pydantic_v1.py | test_forward_refs_fn_scope_manual_resolvable | 198 | null | |
drivendataorg/erdantic | import typing
import pytest
from erdantic.exceptions import _UnevaluatedForwardRefError
from erdantic.typing_utils import (
get_depth1_bases,
get_recursive_args,
is_collection_type_of,
is_nullable_type,
repr_type_with_mro,
)
def test_repr_type_with_mro():
class FancyInt(int):
pass
... | repr(FancyInt()) | assert | func_call | tests/test_typing_utils.py | test_repr_type_with_mro | 108 | null | |
drivendataorg/erdantic | from pprint import pprint
from typing import Optional
from attrs import define, resolve_types
import pytest
from erdantic.core import EntityRelationshipDiagram, FullyQualifiedName
import erdantic.examples.attrs as attrs_examples
from erdantic.exceptions import UnresolvableForwardRefError
from erdantic.plugins.attrs i... | Optional[attrs_examples.Quest] | assert | complex_expr | tests/test_attrs.py | test_forward_refs_fn_scope_auto_resolvable | 123 | null | |
drivendataorg/erdantic | from pprint import pprint
import sys
from typing import Optional
import pydantic
import pydantic.v1
import pytest
from erdantic.core import EntityRelationshipDiagram, FullyQualifiedName
import erdantic.examples.pydantic as pydantic_examples
from erdantic.exceptions import UnresolvableForwardRefError
def test_forward... | GlobalOtherModelBefore | assert | variable | tests/test_pydantic_v1.py | test_forward_refs_fn_scope_auto_resolvable | 140 | null | |
drivendataorg/erdantic | from pprint import pprint
import sys
from typing import Optional
import pydantic
import pytest
from erdantic.core import EntityRelationshipDiagram, FullyQualifiedName
import erdantic.examples.pydantic as pydantic_examples
from erdantic.exceptions import UnresolvableForwardRefError
from erdantic.plugins.pydantic impor... | "datetime" | assert | string_literal | tests/test_pydantic.py | test_get_fields_from_pydantic_model | 49 | null | |
drivendataorg/erdantic | import typing
import pytest
from erdantic.exceptions import _UnevaluatedForwardRefError
from erdantic.typing_utils import (
get_depth1_bases,
get_recursive_args,
is_collection_type_of,
is_nullable_type,
repr_type_with_mro,
)
def test_get_recursive_args():
tp = typing.Optional[typing.Dict[str,... | [int, T] | assert | collection | tests/test_typing_utils.py | test_get_recursive_args | 52 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.