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 |
|---|---|---|---|---|---|---|---|---|---|
executablebooks/markdown-it-py | import json
from pathlib import Path
import pytest
from markdown_it import MarkdownIt
SPEC_INPUT = Path(__file__).parent.joinpath("spec.md")
TESTS_INPUT = Path(__file__).parent.joinpath("commonmark.json")
@pytest.mark.parametrize("entry", json.loads(TESTS_INPUT.read_text()))
def test_spec(entry):
md = MarkdownI... | expected | assert | variable | tests/test_cmark_spec/test_spec.py | test_spec | 36 | null | |
executablebooks/markdown-it-py | from markdown_it import MarkdownIt
def test_ref_definitions():
md = MarkdownIt()
src = "[a]: abc\n\n[b]: xyz\n\n[b]: ijk"
env = {} # type: ignore
tokens = md.parse(src, env)
assert tokens == | [] | assert | collection | tests/test_port/test_references.py | test_ref_definitions | 9 | null | |
executablebooks/markdown-it-py | from markdown_it import MarkdownIt
def test_ref_definitions():
md = MarkdownIt()
src = "[a]: abc\n\n[b]: xyz\n\n[b]: ijk"
env = {} # type: ignore
tokens = md.parse(src, env)
assert tokens == []
assert env == | { "references": { "A": {"title": "", "href": "abc", "map": [0, 1]}, "B": {"title": "", "href": "xyz", "map": [2, 3]}, }, "duplicate_refs": [{"href": "ijk", "label": "B", "map": [4, 5], "title": ""}], } | assert | collection | tests/test_port/test_references.py | test_ref_definitions | 10 | null | |
executablebooks/markdown-it-py | from contextlib import redirect_stdout
import io
import pathlib
import tempfile
from unittest.mock import patch
import pytest
from markdown_it.cli import parse
def test_parse():
with tempfile.TemporaryDirectory() as tempdir:
path = pathlib.Path(tempdir).joinpath("test.md")
path.write_text("a b c"... | 0 | assert | numeric_literal | tests/test_cli.py | test_parse | 16 | null | |
executablebooks/markdown-it-py | import pytest
from markdown_it import MarkdownIt
@pytest.mark.parametrize(
"input,expected",
[
("#", "<h1></h1>\n"),
("###", "<h3></h3>\n"),
("` `", "<p><code> </code></p>\n"),
("``````", "<pre><code></code></pre>\n"),
("-", "<ul>\n<li></li>\n</ul>\n"),
("1.", "... | expected | assert | variable | tests/test_port/test_no_end_newline.py | test_no_end_newline | 27 | null | |
executablebooks/markdown-it-py | import warnings
from markdown_it.token import Token
def test_token():
token = Token("name", "tag", 0)
assert token.as_dict() == {
"type": "name",
"tag": "tag",
"nesting": 0,
"attrs": None,
"map": None,
"level": 0,
"children": None,
"content": "",... | "b" | assert | string_literal | tests/test_api/test_token.py | test_token | 24 | null | |
executablebooks/markdown-it-py | from markdown_it import MarkdownIt
from markdown_it.token import Token
def test_get_rules():
md = MarkdownIt("zero")
# print(md.get_all_rules())
assert md.get_all_rules() == | { "core": [ "normalize", "block", "inline", "linkify", "replacements", "smartquotes", "text_join", ], "block": [ "table", "code", "fence", "blockquote", "hr", "list", "reference", "html_block", "heading", "lheading", "paragraph", ], "inline": [ "text", "linkify", "newline", "escape", "backticks", "strikethrough", "emph... | assert | collection | tests/test_api/test_main.py | test_get_rules | 8 | null | |
executablebooks/markdown-it-py | from markdown_it import MarkdownIt
def test_token_levels():
mdit = MarkdownIt(options_update={"linkify": True}).enable("linkify")
tokens = mdit.parse("www.python.org")
inline = tokens[1]
assert inline.type == "inline"
assert inline.children
link_open = inline.children[0]
assert link_open.ty... | 0 | assert | numeric_literal | tests/test_linkify.py | test_token_levels | 18 | null | |
executablebooks/markdown-it-py | from markdown_it import MarkdownIt
from markdown_it.tree import SyntaxTreeNode
EXAMPLE_MARKDOWN = """
## Heading here
Some paragraph text and **emphasis here** and more text here.
"""
def test_property_passthrough():
tokens = MarkdownIt().parse(EXAMPLE_MARKDOWN)
heading_open = tokens[0]
tree = SyntaxTree... | heading_node.info | assert | complex_expr | tests/test_tree.py | test_property_passthrough | 27 | null | |
executablebooks/markdown-it-py | from markdown_it import MarkdownIt
from markdown_it.tree import SyntaxTreeNode
EXAMPLE_MARKDOWN = """
## Heading here
Some paragraph text and **emphasis here** and more text here.
"""
def test_type():
tokens = MarkdownIt().parse(EXAMPLE_MARKDOWN)
tree = SyntaxTreeNode(tokens)
# Root type is "root"
a... | "root" | assert | string_literal | tests/test_tree.py | test_type | 37 | null | |
executablebooks/markdown-it-py | from markdown_it import MarkdownIt, presets
def highlight_func(str_, lang, attrs):
assert lang == | "a" | assert | string_literal | tests/test_port/test_misc.py | highlight_func | 6 | null | |
executablebooks/markdown-it-py | import pytest
from markdown_it import MarkdownIt
TESTS = {
55363: (">```\n>", "<blockquote>\n<pre><code></code></pre>\n</blockquote>\n"),
55367: (">-\n>\n>", "<blockquote>\n<ul>\n<li></li>\n</ul>\n</blockquote>\n"),
55371: ("[](soH0;!", "<p>[](so&#4H0;!</p>\n"),
# 55401: (("?c_" * 100000) + "c_... | expected | assert | variable | tests/test_fuzzer.py | test_fuzzing | 25 | null | |
executablebooks/markdown-it-py | from markdown_it import MarkdownIt
from markdown_it.tree import SyntaxTreeNode
EXAMPLE_MARKDOWN = """
## Heading here
Some paragraph text and **emphasis here** and more text here.
"""
def test_type():
tokens = MarkdownIt().parse(EXAMPLE_MARKDOWN)
tree = SyntaxTreeNode(tokens)
# Root type is "root"
as... | "inline" | assert | string_literal | tests/test_tree.py | test_type | 42 | null | |
executablebooks/markdown-it-py | from markdown_it import MarkdownIt
from markdown_it.tree import SyntaxTreeNode
EXAMPLE_MARKDOWN = """
## Heading here
Some paragraph text and **emphasis here** and more text here.
"""
def test_walk():
tokens = MarkdownIt().parse(EXAMPLE_MARKDOWN)
tree = SyntaxTreeNode(tokens)
expected_node_types = (
... | expected_type | assert | variable | tests/test_tree.py | test_walk | 102 | null | |
executablebooks/markdown-it-py | from markdown_it import MarkdownIt
from markdown_it.tree import SyntaxTreeNode
EXAMPLE_MARKDOWN = """
## Heading here
Some paragraph text and **emphasis here** and more text here.
"""
def test_type():
tokens = MarkdownIt().parse(EXAMPLE_MARKDOWN)
tree = SyntaxTreeNode(tokens)
# Root type is "root"
as... | "heading" | assert | string_literal | tests/test_tree.py | test_type | 39 | null | |
executablebooks/markdown-it-py | from markdown_it import MarkdownIt
def test_use_existing_env(data_regression):
md = MarkdownIt()
src = "[a]\n\n[c]: ijk"
env = {
"references": {
"A": {"title": "", "href": "abc", "map": [0, 1]},
"B": {"title": "", "href": "xyz", "map": [2, 3]},
}
}
tokens = m... | { "references": { "A": {"title": "", "href": "abc", "map": [0, 1]}, "B": {"title": "", "href": "xyz", "map": [2, 3]}, "C": {"title": "", "href": "ijk", "map": [2, 3]}, } } | assert | collection | tests/test_port/test_references.py | test_use_existing_env | 30 | null | |
executablebooks/markdown-it-py | from markdown_it import MarkdownIt
from markdown_it.token import Token
def test_enable():
md = MarkdownIt("zero").enable("heading")
assert md.get_active_rules() == | { "block": ["heading", "paragraph"], "core": ["normalize", "block", "inline", "text_join"], "inline": ["text"], "inline2": ["balance_pairs", "fragments_join"], } | assert | collection | tests/test_api/test_main.py | test_enable | 97 | null | |
zappa/Zappa | import os
import random
import string
import unittest
from io import BytesIO
import mock
from zappa.cli import ZappaCLI
from zappa.core import Zappa
from zappa.handler import LambdaHandler
from zappa.utilities import add_event_source, remove_event_source
from .utils import placebo_session
def random_string(length):... | events is not None) | self.assertTrue | complex_expr | tests/test_placebo.py | test_fetch_logs | TestZappa | 206 | null |
zappa/Zappa | import json
import os
import re
import tempfile
import unittest
from pathlib import Path
from typing import Tuple
from unittest import mock
from zappa.core import Zappa
from zappa.ext.django_zappa import get_django_wsgi
from zappa.utilities import (
ApacheNCSAFormatter,
InvalidAwsLambdaName,
conflicts_with... | expected) | self.assertEqual | variable | tests/test_utilities.py | test_with_response_time__true | ApacheNCSAFormatterTestCase | 348 | null |
zappa/Zappa | import base64
import collections
import hashlib
import io
import json
import os
import random
import re
import shutil
import string
import sys
import tempfile
import unittest
import uuid
import zipfile
from contextlib import redirect_stdout
from functools import partial
from io import BytesIO
from pathlib import Path
f... | []) | self.assertEqual | collection | tests/test_core.py | test_update_layers | TestZappa | 869 | null |
zappa/Zappa | import sys
import unittest
from io import BytesIO
from zappa.middleware import ZappaWSGIMiddleware, all_casings
from zappa.wsgi import create_wsgi_request
class TestWSGIMockMiddleWare(unittest.TestCase):
def setUp(self):
"""
Set the test up with default headers and status codes.
"""
... | "") | self.assertEqual | string_literal | tests/test_middleware.py | test_should_allow_empty_query_params | TestWSGIMockMiddleWare | 249 | null |
zappa/Zappa | import json
import os
import re
import tempfile
import unittest
from pathlib import Path
from typing import Tuple
from unittest import mock
from zappa.core import Zappa
from zappa.ext.django_zappa import get_django_wsgi
from zappa.utilities import (
ApacheNCSAFormatter,
InvalidAwsLambdaName,
conflicts_with... | "") | self.assertEqual | string_literal | tests/test_utilities.py | test_s3_url_parser | GeneralUtilitiesTestCase | 234 | null |
zappa/Zappa | import os
import unittest
import boto3
import mock
from zappa.asynchronous import (
AsyncException,
LambdaAsyncResponse,
SnsAsyncResponse,
get_func_task_path,
import_and_get_task,
)
from zappa.utilities import UnserializableJsonError
class TestZappa(unittest.TestCase):
def setUp(self):
... | False) | self.assertFalse | bool_literal | tests/test_async.py | test_test | TestZappa | 46 | null |
zappa/Zappa | import sys
import unittest
from io import BytesIO
from zappa.middleware import ZappaWSGIMiddleware, all_casings
from zappa.wsgi import create_wsgi_request
class TestWSGIMockMiddleWare(unittest.TestCase):
def setUp(self):
"""
Set the test up with default headers and status codes.
"""
... | 512) | self.assertEqual | numeric_literal | tests/test_middleware.py | test_all_casings | TestWSGIMockMiddleWare | 33 | null |
zappa/Zappa | import json
import os
import re
import tempfile
import unittest
from pathlib import Path
from typing import Tuple
from unittest import mock
from zappa.core import Zappa
from zappa.ext.django_zappa import get_django_wsgi
from zappa.utilities import (
ApacheNCSAFormatter,
InvalidAwsLambdaName,
conflicts_with... | yay > 0) | self.assertTrue | complex_expr | tests/test_utilities.py | test_string_to_timestamp | GeneralUtilitiesTestCase | 189 | null |
zappa/Zappa | import unittest
from typing import Any, Tuple
from mock import Mock
from zappa.handler import LambdaHandler
from zappa.utilities import merge_headers
from .utils import is_base64
def no_args() -> None:
return
def one_arg(first: Any) -> Any:
return first
def two_args(first: Any, second: Any) -> Tuple[Any, ... | "c") | self.assertEqual | string_literal | tests/test_handler.py | test_merge_headers_combine_values | TestZappa | 555 | null |
zappa/Zappa | import os
import random
import string
import unittest
from io import BytesIO
import mock
from zappa.cli import ZappaCLI
from zappa.core import Zappa
from zappa.handler import LambdaHandler
from zappa.utilities import add_event_source, remove_event_source
from .utils import placebo_session
def random_string(length):... | lh.handler(event, None)) | self.assertEqual | func_call | tests/test_placebo.py | test_handler | TestZappa | 276 | null |
zappa/Zappa | import sys
import unittest
from io import BytesIO
from zappa.middleware import ZappaWSGIMiddleware, all_casings
from zappa.wsgi import create_wsgi_request
class TestWSGIMockMiddleWare(unittest.TestCase):
def setUp(self):
"""
Set the test up with default headers and status codes.
"""
... | "foo=1&foo=2") | self.assertEqual | string_literal | tests/test_middleware.py | test_should_handle_multi_value_query_string_params | TestWSGIMockMiddleWare | 279 | null |
zappa/Zappa | import json
import os
import re
import tempfile
import unittest
from pathlib import Path
from typing import Tuple
from unittest import mock
from zappa.core import Zappa
from zappa.ext.django_zappa import get_django_wsgi
from zappa.utilities import (
ApacheNCSAFormatter,
InvalidAwsLambdaName,
conflicts_with... | transformed) | self.assertEqual | variable | tests/test_utilities.py | test_titlecase_keys | GeneralUtilitiesTestCase | 280 | null |
zappa/Zappa | import base64
import collections
import hashlib
import io
import json
import os
import random
import re
import shutil
import string
import sys
import tempfile
import unittest
import uuid
import zipfile
from contextlib import redirect_stdout
from functools import partial
from io import BytesIO
from pathlib import Path
f... | 30) | self.assertEqual | numeric_literal | tests/test_core.py | test_zappacli_settings | TestZappa | 1,680 | null |
zappa/Zappa | import sys
import unittest
from io import BytesIO
from zappa.middleware import ZappaWSGIMiddleware, all_casings
from zappa.wsgi import create_wsgi_request
class TestWSGIMockMiddleWare(unittest.TestCase):
def setUp(self):
"""
Set the test up with default headers and status codes.
"""
... | "user1") | self.assertEqual | string_literal | tests/test_middleware.py | test_wsgi_authorizer_handling | TestWSGIMockMiddleWare | 90 | null |
zappa/Zappa | import sys
import unittest
from io import BytesIO
from zappa.middleware import ZappaWSGIMiddleware, all_casings
from zappa.wsgi import create_wsgi_request
class TestWSGIMockMiddleWare(unittest.TestCase):
def setUp(self):
"""
Set the test up with default headers and status codes.
"""
... | "myCognitoID") | self.assertEqual | string_literal | tests/test_middleware.py | test_wsgi_map_context_headers_handling | TestWSGIMockMiddleWare | 206 | null |
zappa/Zappa | import os
import random
import string
import unittest
from io import BytesIO
import mock
from zappa.cli import ZappaCLI
from zappa.core import Zappa
from zappa.handler import LambdaHandler
from zappa.utilities import add_event_source, remove_event_source
from .utils import placebo_session
def random_string(length):... | fail) | self.assertFalse | variable | tests/test_placebo.py | test_upload_remove_s3 | TestZappa | 61 | null |
zappa/Zappa | import os
import unittest
import boto3
import mock
from zappa.asynchronous import (
AsyncException,
LambdaAsyncResponse,
SnsAsyncResponse,
get_func_task_path,
import_and_get_task,
)
from zappa.utilities import UnserializableJsonError
class TestZappa(unittest.TestCase):
def setUp(self):
... | "Running async!") | self.assertEqual | string_literal | tests/test_async.py | test_async_call_with_defaults | TestZappa | 86 | null |
zappa/Zappa | import base64
import collections
import hashlib
import io
import json
import os
import random
import re
import shutil
import string
import sys
import tempfile
import unittest
import uuid
import zipfile
from contextlib import redirect_stdout
from functools import partial
from io import BytesIO
from pathlib import Path
f... | "") | self.assertEqual | string_literal | tests/test_core.py | test_wsgi_from_v2_event | TestZappa | 1,434 | null |
zappa/Zappa | import sys
import unittest
from io import BytesIO
from zappa.middleware import ZappaWSGIMiddleware, all_casings
from zappa.wsgi import create_wsgi_request
class TestWSGIMockMiddleWare(unittest.TestCase):
def setUp(self):
"""
Set the test up with default headers and status codes.
"""
... | 1) | self.assertEqual | numeric_literal | tests/test_middleware.py | test_all_casings | TestWSGIMockMiddleWare | 40 | null |
zappa/Zappa | import json
import os
import re
import tempfile
import unittest
from pathlib import Path
from typing import Tuple
from unittest import mock
from zappa.core import Zappa
from zappa.ext.django_zappa import get_django_wsgi
from zappa.utilities import (
ApacheNCSAFormatter,
InvalidAwsLambdaName,
conflicts_with... | 1) | self.assertEqual | numeric_literal | tests/test_utilities.py | test_copy_editable_packages | GeneralUtilitiesTestCase | 86 | null |
zappa/Zappa | import sys
import unittest
from io import BytesIO
from zappa.middleware import ZappaWSGIMiddleware, all_casings
from zappa.wsgi import create_wsgi_request
class TestWSGIMockMiddleWare(unittest.TestCase):
def setUp(self):
"""
Set the test up with default headers and status codes.
"""
... | BytesIO) | self.assertEqual | variable | tests/test_middleware.py | test_wsgi_input_as_file_like_object | TestWSGIMockMiddleWare | 219 | null |
zappa/Zappa | import base64
import collections
import hashlib
import io
import json
import os
import random
import re
import shutil
import string
import sys
import tempfile
import unittest
import uuid
import zipfile
from contextlib import redirect_stdout
from functools import partial
from io import BytesIO
from pathlib import Path
f... | True) | self.assertTrue | bool_literal | tests/test_core.py | test_test | TestZappa | 77 | null |
zappa/Zappa | import os
import unittest
import boto3
import mock
from zappa.asynchronous import (
AsyncException,
LambdaAsyncResponse,
SnsAsyncResponse,
get_func_task_path,
import_and_get_task,
)
from zappa.utilities import UnserializableJsonError
class TestZappa(unittest.TestCase):
def setUp(self):
... | UnserializableJsonError) | self.assertRaises | variable | tests/test_async.py | test_async_call_arg_not_json_serializable | TestZappa | 101 | null |
zappa/Zappa | import unittest
from typing import Any, Tuple
from mock import Mock
from zappa.handler import LambdaHandler
from zappa.utilities import merge_headers
from .utils import is_base64
def no_args() -> None:
return
def one_arg(first: Any) -> Any:
return first
def two_args(first: Any, second: Any) -> Tuple[Any, ... | "b") | self.assertEqual | string_literal | tests/test_handler.py | test_merge_headers_no_multi_value | TestZappa | 546 | null |
zappa/Zappa | import os
import random
import string
import unittest
from io import BytesIO
import mock
from zappa.cli import ZappaCLI
from zappa.core import Zappa
from zappa.handler import LambdaHandler
from zappa.utilities import add_event_source, remove_event_source
from .utils import placebo_session
def random_string(length):... | "arn:aws:iam::123:role/{}".format(z.role_name)) | self.assertEqual | string_literal | tests/test_placebo.py | test_create_iam_roles | TestZappa | 193 | null |
zappa/Zappa | import os
import unittest
import boto3
import mock
from zappa.asynchronous import (
AsyncException,
LambdaAsyncResponse,
SnsAsyncResponse,
get_func_task_path,
import_and_get_task,
)
from zappa.utilities import UnserializableJsonError
class TestZappa(unittest.TestCase):
def setUp(self):
... | True) | self.assertTrue | bool_literal | tests/test_async.py | test_test | TestZappa | 45 | null |
zappa/Zappa | import os
import random
import string
import unittest
from io import BytesIO
import mock
from zappa.cli import ZappaCLI
from zappa.core import Zappa
from zappa.handler import LambdaHandler
from zappa.utilities import add_event_source, remove_event_source
from .utils import placebo_session
def random_string(length):... | too_many_versions) | self.assertFalse | variable | tests/test_placebo.py | test_rollback_lambda_function_version | TestZappa | 166 | null |
zappa/Zappa | import os
import random
import string
import unittest
from io import BytesIO
import mock
from zappa.cli import ZappaCLI
from zappa.core import Zappa
from zappa.handler import LambdaHandler
from zappa.utilities import add_event_source, remove_event_source
from .utils import placebo_session
def random_string(length):... | NotImplementedError) | self.assertRaises | variable | tests/test_placebo.py | test_rollback_lambda_function_version_docker | TestZappa | 177 | null |
zappa/Zappa | import json
import os
import re
import tempfile
import unittest
from pathlib import Path
from typing import Tuple
from unittest import mock
from zappa.core import Zappa
from zappa.ext.django_zappa import get_django_wsgi
from zappa.utilities import (
ApacheNCSAFormatter,
InvalidAwsLambdaName,
conflicts_with... | "account.key") | self.assertEqual | string_literal | tests/test_utilities.py | test_s3_url_parser | GeneralUtilitiesTestCase | 218 | null |
zappa/Zappa | import logging
import pytest
from zappa.handler import LambdaHandler
event = {
"body": "",
"resource": "/{proxy+}",
"requestContext": {},
"queryStringParameters": {},
"headers": {
"Host": "example.com",
},
"pathParameters": {"proxy": "root-logger"},
"httpMethod": "GET",
"s... | caplog.record_tuples | assert | complex_expr | tests/test_wsgi_root_log_level.py | test_wsgi_root_log_level_debug | 44 | null | |
zappa/Zappa | import os
import unittest
import boto3
import mock
from zappa.asynchronous import (
AsyncException,
LambdaAsyncResponse,
SnsAsyncResponse,
get_func_task_path,
import_and_get_task,
)
from zappa.utilities import UnserializableJsonError
class TestZappa(unittest.TestCase):
def setUp(self):
... | {}) | assert_* | collection | tests/test_async.py | test_async_call_with_defaults | TestZappa | 95 | null |
zappa/Zappa | import json
import os
import re
import tempfile
import unittest
from pathlib import Path
from typing import Tuple
from unittest import mock
from zappa.core import Zappa
from zappa.ext.django_zappa import get_django_wsgi
from zappa.utilities import (
ApacheNCSAFormatter,
InvalidAwsLambdaName,
conflicts_with... | "your-bucket") | self.assertEqual | string_literal | tests/test_utilities.py | test_s3_url_parser | GeneralUtilitiesTestCase | 217 | null |
zappa/Zappa | import os
import random
import string
import unittest
from io import BytesIO
import mock
from zappa.cli import ZappaCLI
from zappa.core import Zappa
from zappa.handler import LambdaHandler
from zappa.utilities import add_event_source, remove_event_source
from .utils import placebo_session
def random_string(length):... | "world") | self.assertEqual | string_literal | tests/test_placebo.py | test_handler | TestZappa | 220 | null |
zappa/Zappa | import sys
import unittest
from io import BytesIO
from zappa.middleware import ZappaWSGIMiddleware, all_casings
from zappa.wsgi import create_wsgi_request
class TestWSGIMockMiddleWare(unittest.TestCase):
def setUp(self):
"""
Set the test up with default headers and status codes.
"""
... | "no_user") | self.assertEqual | string_literal | tests/test_middleware.py | test_wsgi_authorizer_handling | TestWSGIMockMiddleWare | 107 | null |
zappa/Zappa | import base64
import collections
import hashlib
import io
import json
import os
import random
import re
import shutil
import string
import sys
import tempfile
import unittest
import uuid
import zipfile
from contextlib import redirect_stdout
from functools import partial
from io import BytesIO
from pathlib import Path
f... | 2) | self.assertEqual | numeric_literal | tests/test_core.py | test_deploy_lambda_function_url | TestZappa | 3,577 | null |
zappa/Zappa | import unittest
from typing import Any, Tuple
from mock import Mock
from zappa.handler import LambdaHandler
from zappa.utilities import merge_headers
from .utils import is_base64
def no_args() -> None:
return
def one_arg(first: Any) -> Any:
return first
def two_args(first: Any, second: Any) -> Tuple[Any, ... | "e") | self.assertEqual | string_literal | tests/test_handler.py | test_run_function | TestZappa | 58 | null |
zappa/Zappa | import base64
import collections
import hashlib
import io
import json
import os
import random
import re
import shutil
import string
import sys
import tempfile
import unittest
import uuid
import zipfile
from contextlib import redirect_stdout
from functools import partial
from io import BytesIO
from pathlib import Path
f... | None | assert | none_literal | tests/test_core.py | test_domain_name_match | TestZappa | 2,484 | null |
zappa/Zappa | import json
import os
import re
import tempfile
import unittest
from pathlib import Path
from typing import Tuple
from unittest import mock
from zappa.core import Zappa
from zappa.ext.django_zappa import get_django_wsgi
from zappa.utilities import (
ApacheNCSAFormatter,
InvalidAwsLambdaName,
conflicts_with... | boo == 0) | self.assertTrue | complex_expr | tests/test_utilities.py | test_string_to_timestamp | GeneralUtilitiesTestCase | 185 | null |
zappa/Zappa | import os
import unittest
import boto3
import mock
from zappa.asynchronous import (
AsyncException,
LambdaAsyncResponse,
SnsAsyncResponse,
get_func_task_path,
import_and_get_task,
)
from zappa.utilities import UnserializableJsonError
class TestZappa(unittest.TestCase):
def setUp(self):
... | "run async when on lambda 123") | self.assertEqual | string_literal | tests/test_async.py | test_sync_call | TestZappa | 66 | null |
zappa/Zappa | import base64
import collections
import hashlib
import io
import json
import os
import random
import re
import shutil
import string
import sys
import tempfile
import unittest
import uuid
import zipfile
from contextlib import redirect_stdout
from functools import partial
from io import BytesIO
from pathlib import Path
f... | 512) | self.assertEqual | numeric_literal | tests/test_core.py | test_zappacli_settings | TestZappa | 1,663 | null |
zappa/Zappa | import base64
import collections
import hashlib
import io
import json
import os
import random
import re
import shutil
import string
import sys
import tempfile
import unittest
import uuid
import zipfile
from contextlib import redirect_stdout
from functools import partial
from io import BytesIO
from pathlib import Path
f... | False | assert | bool_literal | tests/test_core.py | test_disable_click_colors | TestZappa | 89 | null |
zappa/Zappa | import base64
import collections
import hashlib
import io
import json
import os
import random
import re
import shutil
import string
import sys
import tempfile
import unittest
import uuid
import zipfile
from contextlib import redirect_stdout
from functools import partial
from io import BytesIO
from pathlib import Path
f... | 256) | self.assertEqual | numeric_literal | tests/test_core.py | test_load_settings_from_environment_variables | TestZappa | 2,189 | null |
zappa/Zappa | import logging
import pytest
from zappa.handler import LambdaHandler
event = {
"body": "",
"resource": "/{proxy+}",
"requestContext": {},
"queryStringParameters": {},
"headers": {
"Host": "example.com",
},
"pathParameters": {"proxy": "root-logger"},
"httpMethod": "GET",
"s... | 200 | assert | numeric_literal | tests/test_wsgi_root_log_level.py | test_wsgi_root_log_level_debug | 43 | null | |
zappa/Zappa | import sys
import unittest
from io import BytesIO
from zappa.middleware import ZappaWSGIMiddleware, all_casings
from zappa.wsgi import create_wsgi_request
class TestWSGIMockMiddleWare(unittest.TestCase):
def setUp(self):
"""
Set the test up with default headers and status codes.
"""
... | environ) | self.assertNotIn | variable | tests/test_middleware.py | test_wsgi_map_context_headers_handling | TestWSGIMockMiddleWare | 208 | null |
jonghwanhyeon/python-ffmpeg | import os
from pathlib import Path
from ffmpeg.options import Options
def test_options(assets_path: Path, tmp_path: Path):
pier39_path = assets_path / "pier-39.mov"
snow_path = assets_path / "snow.mov"
output_path = tmp_path / "output.mp4"
options = Options()
options.option("y")
assert [*opti... | [ # fmt: off "-y", "-i", os.fspath(pier39_path), "-codec:v", "libx264", "-preset", "veryfast", "-crf", "24", os.fspath(output_path), # fmt: on ] | assert | collection | tests/test_options.py | test_options | 35 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
import pytest
from helpers import probe
from ffmpeg.asyncio import FFmpeg
epsilon = 0.25
@pytest.mark.asyncio
async def test_asyncio_transcoding(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "pier-39.ts"
target_path = tmp_path / "pier-39.mp4"
ffmpeg... | epsilon | assert | variable | tests/test_asyncio_transcoding.py | test_asyncio_transcoding | 32 | null | |
jonghwanhyeon/python-ffmpeg | import asyncio
from pathlib import Path
import pytest
from ffmpeg import FFmpegAlreadyExecuted, FFmpegFileNotFound, FFmpegInvalidCommand, FFmpegUnsupportedCodec
from ffmpeg.asyncio import FFmpeg
@pytest.mark.asyncio
async def test_asyncio_raises_already_executed(
assets_path: Path,
tmp_path: Path,
):
sou... | FFmpegAlreadyExecuted) | pytest.raises | variable | tests/test_asyncio_errors.py | test_asyncio_raises_already_executed | 28 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
import pytest
from helpers import probe
from ffmpeg.asyncio import FFmpeg
epsilon = 0.25
@pytest.mark.asyncio
async def test_asyncio_transcoding(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "pier-39.ts"
target_path = tmp_path / "pier-39.mp4"
ffmpeg... | target["format"]["format_name"] | assert | complex_expr | tests/test_asyncio_transcoding.py | test_asyncio_transcoding | 33 | null | |
jonghwanhyeon/python-ffmpeg | from datetime import timedelta
from ffmpeg.statistics import Statistics
def test_statistics():
assert Statistics.from_line(
"size= 243kB time=00:01:01.47 bitrate= 32.4kbits/s speed= 123x",
) == Statistics(
frame=0,
fps=0.0,
size=243 * 1024,
time=timedelta(minutes=1... | None | assert | none_literal | tests/test_statistics.py | test_statistics | 51 | null | |
jonghwanhyeon/python-ffmpeg | import os
from pathlib import Path
from ffmpeg.options import Options
def test_options(assets_path: Path, tmp_path: Path):
pier39_path = assets_path / "pier-39.mov"
snow_path = assets_path / "snow.mov"
output_path = tmp_path / "output.mp4"
options = Options()
options.option("y")
assert [*opti... | ["-y", "-loglevel", "verbose"] | assert | collection | tests/test_options.py | test_options | 19 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
import pytest
from ffmpeg import FFmpeg, FFmpegAlreadyExecuted, FFmpegFileNotFound, FFmpegInvalidCommand, FFmpegUnsupportedCodec
def test_raises_already_executed(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "pier-39.ts"
target_path = tmp_path / "pier-39.... | FFmpegAlreadyExecuted) | pytest.raises | variable | tests/test_errors.py | test_raises_already_executed | 25 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
import pytest
from ffmpeg.asyncio import FFmpeg
@pytest.mark.asyncio
async def test_asyncio_exception_raising(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "pier-39.ts"
target_path = tmp_path / "pier-39.mp4"
raised_error = RuntimeError("Raised error"... | raised_error | assert | variable | tests/test_asyncio_listeners.py | test_asyncio_exception_raising | 37 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
import pytest
from helpers import probe
from ffmpeg.asyncio import FFmpeg
epsilon = 0.25
@pytest.mark.asyncio
async def test_asyncio_transcoding(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "pier-39.ts"
target_path = tmp_path / "pier-39.mp4"
ffmpeg... | target["streams"][1]["codec_name"] | assert | complex_expr | tests/test_asyncio_transcoding.py | test_asyncio_transcoding | 36 | null | |
jonghwanhyeon/python-ffmpeg | import asyncio
from pathlib import Path
import pytest
from ffmpeg import FFmpegAlreadyExecuted, FFmpegFileNotFound, FFmpegInvalidCommand, FFmpegUnsupportedCodec
from ffmpeg.asyncio import FFmpeg
@pytest.mark.asyncio
async def test_asyncio_raises_file_not_found(
assets_path: Path,
tmp_path: Path,
):
inval... | FFmpegFileNotFound) | pytest.raises | variable | tests/test_asyncio_errors.py | test_asyncio_raises_file_not_found | 41 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
import pytest
from helpers import probe
from ffmpeg.asyncio import FFmpeg
epsilon = 0.25
@pytest.mark.asyncio
async def test_asyncio_output_via_stdout(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "brewing.wav"
target_path = tmp_path / "brewing.ogg"
... | "ogg" | assert | string_literal | tests/test_asyncio_pipe.py | test_asyncio_output_via_stdout | 68 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
from helpers import probe
from ffmpeg import FFmpeg
epsilon = 0.25
def test_input_via_stdin(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "pier-39.ts"
target_path = tmp_path / "pier-39.mp4"
with open(source_path, "rb") as source_file:
ffmpeg... | target["streams"][1]["codec_name"] | assert | complex_expr | tests/test_pipe.py | test_input_via_stdin | 36 | null | |
jonghwanhyeon/python-ffmpeg | from datetime import timedelta
from ffmpeg.statistics import Statistics
def test_statistics():
asser | Statistics( frame=0, fps=0.0, size=243 * 1024, time=timedelta(minutes=1, seconds=1, microseconds=470000), bitrate=32.4, speed=123, ) | assert | func_call | tests/test_statistics.py | test_statistics | 7 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
import pytest
from ffmpeg import FFmpeg, FFmpegAlreadyExecuted, FFmpegFileNotFound, FFmpegInvalidCommand, FFmpegUnsupportedCodec
def test_raises_unsupported_codec_for_invalid_decoder(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "pier-39.ts"
target_path =... | FFmpegUnsupportedCodec) | pytest.raises | variable | tests/test_errors.py | test_raises_unsupported_codec_for_invalid_decoder | 97 | null | |
jonghwanhyeon/python-ffmpeg | import asyncio
from pathlib import Path
import pytest
from ffmpeg import FFmpegAlreadyExecuted, FFmpegFileNotFound, FFmpegInvalidCommand, FFmpegUnsupportedCodec
from ffmpeg.asyncio import FFmpeg
@pytest.mark.asyncio
async def test_asyncio_raises_invalid_command_for_invalid_option(
assets_path: Path,
tmp_path... | FFmpegInvalidCommand) | pytest.raises | variable | tests/test_asyncio_errors.py | test_asyncio_raises_invalid_command_for_invalid_option | 61 | null | |
jonghwanhyeon/python-ffmpeg | from datetime import timedelta
from ffmpeg.statistics import Statistics
def test_statistics():
assert Statistics.from_line(
"size= 243kB time=00:01:01.47 bitrate= 32.4kbits/s speed= 123x",
) == Statistics(
frame=0,
fps=0.0,
size=243 * 1024,
time=timedelta(minutes=1... | Statistics( frame=109, fps=0.0, size=793 * 1024, time=timedelta(seconds=4, microseconds=20000), bitrate=1613.7, speed=7.73, ) | assert | func_call | tests/test_statistics.py | test_statistics | 40 | null | |
jonghwanhyeon/python-ffmpeg | import asyncio
from pathlib import Path
import pytest
from ffmpeg.asyncio import FFmpeg
@pytest.mark.asyncio
async def test_asyncio_timeout(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "pier-39.ts"
target_path = tmp_path / "pier-39.mp4"
ffmpeg = (
FFmpeg()
.... | asyncio.TimeoutError) | pytest.raises | complex_expr | tests/test_asyncio_timeout.py | test_asyncio_timeout | 26 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
import pytest
from helpers import probe
from ffmpeg.asyncio import FFmpeg
epsilon = 0.25
@pytest.mark.asyncio
async def test_asyncio_input_via_stdin(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "pier-39.ts"
target_path = tmp_path / "pier-39.mp4"
wi... | epsilon | assert | variable | tests/test_asyncio_pipe.py | test_asyncio_input_via_stdin | 36 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
import pytest
from helpers import probe
from ffmpeg.asyncio import FFmpeg
epsilon = 0.25
@pytest.mark.asyncio
async def test_asyncio_input_via_stdin(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "pier-39.ts"
target_path = tmp_path / "pier-39.mp4"
wi... | target["streams"][1]["codec_name"] | assert | complex_expr | tests/test_asyncio_pipe.py | test_asyncio_input_via_stdin | 40 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
from helpers import probe
from ffmpeg import FFmpeg
epsilon = 0.25
def test_transcoding(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "pier-39.ts"
target_path = tmp_path / "pier-39.mp4"
ffmpeg = (
FFmpeg()
.input(str(source_path))
... | target["streams"][1]["codec_name"] | assert | complex_expr | tests/test_transcoding.py | test_transcoding | 34 | null | |
jonghwanhyeon/python-ffmpeg | from datetime import timedelta
from ffmpeg.statistics import Statistics
def test_statistics():
assert Statistics.from_line(
"size= 243kB time=00:01:01.47 bitrate= 32.4kbits/s speed= 123x",
) == Statistics(
frame=0,
fps=0.0,
size=243 * 1024,
time=timedelta(minutes=1... | Statistics( frame=0, fps=0.0, size=0, time=timedelta(microseconds=330000), bitrate=1.1, speed=22.8, ) | assert | func_call | tests/test_statistics.py | test_statistics | 18 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
from helpers import probe
from ffmpeg import FFmpeg
epsilon = 0.25
def test_transcoding(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "pier-39.ts"
target_path = tmp_path / "pier-39.mp4"
ffmpeg = (
FFmpeg()
.input(str(source_path))
... | target["streams"][0]["codec_name"] | assert | complex_expr | tests/test_transcoding.py | test_transcoding | 33 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
from helpers import probe
from ffmpeg import FFmpeg
epsilon = 0.25
def test_transcoding(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "pier-39.ts"
target_path = tmp_path / "pier-39.mp4"
ffmpeg = (
FFmpeg()
.input(str(source_path))
... | target["format"]["format_name"] | assert | complex_expr | tests/test_transcoding.py | test_transcoding | 31 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
from helpers import probe
from ffmpeg import FFmpeg
epsilon = 0.25
def test_transcoding(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "pier-39.ts"
target_path = tmp_path / "pier-39.mp4"
ffmpeg = (
FFmpeg()
.input(str(source_path))
... | epsilon | assert | variable | tests/test_transcoding.py | test_transcoding | 30 | null | |
jonghwanhyeon/python-ffmpeg | import subprocess
from pathlib import Path
import pytest
from ffmpeg import FFmpeg
def test_transcoding(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "pier-39.ts"
target_path = tmp_path / "pier-39.mp4"
ffmpeg = (
FFmpeg()
.input(str(source_path))
.out... | subprocess.TimeoutExpired) | pytest.raises | complex_expr | tests/test_timeout.py | test_transcoding | 25 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
import pytest
from ffmpeg import FFmpeg, FFmpegAlreadyExecuted, FFmpegFileNotFound, FFmpegInvalidCommand, FFmpegUnsupportedCodec
def test_raises_invalid_command_for_invalid_option(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "pier-39.ts"
target_path = tm... | FFmpegInvalidCommand) | pytest.raises | variable | tests/test_errors.py | test_raises_invalid_command_for_invalid_option | 56 | null | |
jonghwanhyeon/python-ffmpeg | from datetime import timedelta
from ffmpeg.statistics import Statistics
def test_statistics():
assert Statistics.from_line(
"size= 243kB time=00:01:01.47 bitrate= 32.4kbits/s speed= 123x",
) == Statistics(
frame=0,
fps=0.0,
size=243 * 1024,
time=timedelta(minutes=1... | Statistics( frame=109, fps=0.0, size=793 * 1024, time=timedelta(seconds=4, microseconds=20000), bitrate=0, speed=0, ) | assert | func_call | tests/test_statistics.py | test_statistics | 29 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
import pytest
from ffmpeg import FFmpeg, FFmpegAlreadyExecuted, FFmpegFileNotFound, FFmpegInvalidCommand, FFmpegUnsupportedCodec
def test_raises_file_not_found(
assets_path: Path,
tmp_path: Path,
):
invalid_source_path = assets_path / "non-existent.mp4"
target_path = tmp_path... | FFmpegFileNotFound) | pytest.raises | variable | tests/test_errors.py | test_raises_file_not_found | 37 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
from helpers import probe
from ffmpeg import FFmpeg
epsilon = 0.25
def test_input_via_stdin(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "pier-39.ts"
target_path = tmp_path / "pier-39.mp4"
with open(source_path, "rb") as source_file:
ffmpeg... | target["streams"][0]["codec_name"] | assert | complex_expr | tests/test_pipe.py | test_input_via_stdin | 35 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
from helpers import probe
from ffmpeg import FFmpeg
epsilon = 0.25
def test_output_via_stdout(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "brewing.wav"
target_path = tmp_path / "brewing.ogg"
ffmpeg = (
FFmpeg()
.option("y")
... | "ogg" | assert | string_literal | tests/test_pipe.py | test_output_via_stdout | 63 | null | |
jonghwanhyeon/python-ffmpeg | from pathlib import Path
import pytest
from helpers import probe
from ffmpeg.asyncio import FFmpeg
epsilon = 0.25
@pytest.mark.asyncio
async def test_asyncio_input_via_stdin(
assets_path: Path,
tmp_path: Path,
):
source_path = assets_path / "pier-39.ts"
target_path = tmp_path / "pier-39.mp4"
wi... | target["format"]["format_name"] | assert | complex_expr | tests/test_asyncio_pipe.py | test_asyncio_input_via_stdin | 37 | null | |
mlfoundations/open_lm | import pytest
import random
import os
import webdataset as wds
import glob
from open_lm.model import _MODEL_CONFIGS
from open_lm.main import random_seed
from open_lm.data import get_wds_dataset
from open_lm.file_utils import (
get_string_for_epoch,
get_metadata_file,
get_shards_for_chunk,
)
from open_lm.par... | 1 | assert | numeric_literal | tests/test_dataset_no_resample.py | retrieve_dataset_once | 69 | null | |
mlfoundations/open_lm | from open_lm.file_utils import get_string_for_epoch
import pytest
import os
import math
import json
from pathlib import Path
from braceexpand import braceexpand
from tests.utils import download_dl_test_data, make_fake_tarfiles
SINGLE_SOURCE = ["tests/assets/source_id_00/manifest.jsonl"]
def test_gsfe_ss_4():
""... | expected_shards_ps | assert | variable | tests/test_file_utils.py | test_gsfe_ss_4 | 117 | null | |
mlfoundations/open_lm | from open_lm.file_utils import get_string_for_epoch
import pytest
import os
import math
import json
from pathlib import Path
from braceexpand import braceexpand
from tests.utils import download_dl_test_data, make_fake_tarfiles
SINGLE_SOURCE = ["tests/assets/source_id_00/manifest.jsonl"]
@pytest.mark.parametrize("se... | shards_ps_2 | assert | variable | tests/test_file_utils.py | test_shard_shuffling | 177 | null | |
mlfoundations/open_lm | import torch
from open_lm.data import get_wds_dataset, sample_chunk
from tests.shared import MockDataArgs
def test_dataloader_shape():
# basic test to make sure the datalaoder does not crash
args = MockDataArgs()
di = get_wds_dataset(args, True)
batch = next(iter(di.dataloader))
(texts,) = batch
... | args.seq_len | assert | complex_expr | tests/test_dataset_basic.py | test_dataloader_shape | 26 | null | |
mlfoundations/open_lm | from open_lm.main import main, train_one_epoch, load_model
from open_lm.params import parse_args
import shutil
import pytest
import numpy as np
from tensorboard.backend.event_processing import event_accumulator
import pandas as pd
import glob
import os
import torch
import copy
from tests.shared import create_train_fixt... | choice2 | assert | variable | tests/test_training_simple.py | test_good_resume_shard_shuffle | 171 | null | |
mlfoundations/open_lm | import shutil
import os
import pytest
import torch
from huggingface_hub import hf_hub_download
from transformers import GPTNeoXTokenizerFast
from open_lm.utils.transformers.hf_model import OpenLMforCausalLM
from open_lm.utils.transformers.hf_config import OpenLMConfig
from open_lm.model import create_params
from tes... | result_with_cache | assert | variable | tests/test_generate_load_kv_cache_equal.py | test_generate_kv_cache | 109 | null | |
mlfoundations/open_lm | import pytest
import argparse
import random
import os
import webdataset as wds
import glob
from open_lm.model import _MODEL_CONFIGS
from open_lm.main import random_seed
from open_lm.data import get_wds_dataset
from open_lm.file_utils import (
get_string_for_epoch,
get_metadata_file,
get_shards_for_chunk,
)
... | item["num_sequences"] | assert | complex_expr | tests/test_dataset_deterministic.py | test_count_manifest | 159 | null | |
mlfoundations/open_lm | from open_lm.main import main, train_one_epoch, load_model
from open_lm.params import parse_args
import shutil
import pytest
import numpy as np
from tensorboard.backend.event_processing import event_accumulator
import pandas as pd
import glob
import os
import torch
import copy
from tests.shared import create_train_fixt... | 1e-7 | assert | numeric_literal | tests/test_training_simple.py | test_lr_scheduling_from_main | 412 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.