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
isso-comments/isso
import unittest import textwrap from isso import config from isso.html import Markup from isso.html.mistune import MistuneMarkdown class TestHTMLMistune(unittest.TestCase): def test_render(self): conf = config.new( { "markup": {"renderer": "mistune", "allowed-elements": "", "a...
[ '<p><a href="http://example.org/" rel="nofollow noopener">http://example.org/</a> and sms:+1234567890</p>', '<p><a rel="nofollow noopener" href="http://example.org/">http://example.org/</a> and sms:+1234567890</p>', ])
self.assertIn
collection
isso/tests/test_html_mistune.py
test_render
TestHTMLMistune
71
null
isso-comments/isso
import tempfile import unittest from os.path import join, dirname from isso import config from isso.db import SQLite3 from isso.migrate import Disqus, WordPress, autodetect, Generic conf = config.new({"general": {"dbpath": "/dev/null", "max-age": "1h"}}) class TestMigration(unittest.TestCase): def test_disqus...
1)
self.assertEqual
numeric_literal
isso/tests/test_migration.py
test_disqus_empty_id_workaround
TestMigration
54
null
isso-comments/isso
import unittest from isso import utils from isso.utils import parse class TestParse(unittest.TestCase): def test_thread(self): self.assertEqual(parse.thread("asdf"), (None, "Untitled.")) self
(None, "Can you find me?"))
self.assertEqual
collection
isso/tests/test_utils.py
test_thread
TestParse
37
null
isso-comments/isso
import unittest import io import os from isso import config class TestConfig(unittest.TestCase): def test_parser_with_special_characters_in_environment_variables(self): os.environ["SPECIAL_ENV_VAR"] = "value_with_$pecial_characters" parser = config.IssoParser() parser.read_file( ...
"value_with_$pecial_characters")
self.assertEqual
string_literal
isso/tests/test_config.py
test_parser_with_special_characters_in_environment_variables
TestConfig
87
null
isso-comments/isso
import unittest import os import sqlite3 import tempfile from isso import config from isso.db import SQLite3 class TestDBMigration(unittest.TestCase): def setUp(self): fd, self.path = tempfile.mkstemp() def tearDown(self): os.unlink(self.path) def test_session_key_migration(self): ...
"supersecretkey")
self.assertEqual
string_literal
isso/tests/test_db.py
test_session_key_migration
TestDBMigration
44
null
isso-comments/isso
import unittest from isso import config from isso.utils.hash import Hash, PBKDF2, new class TestHasher(unittest.TestCase): def test_hash(self): self.assertRaises(TypeError, Hash, "Foo") self.assertEqual(Hash(b"").salt, b"") self.assertEqual(Hash().salt, Hash.salt) h = Hash(b"", ...
(str,))
self.assertIsInstance
collection
isso/tests/test_utils_hash.py
test_hash
TestHasher
21
null
isso-comments/isso
import json import unittest from werkzeug.exceptions import BadRequest from werkzeug.test import create_environ from werkzeug.wrappers import Request from isso import error_handler, wsgi from isso.utils import JSONResponse class TestWSGIUtilities(unittest.TestCase): def test_errorhandler(self): """ ...
500)
self.assertEqual
numeric_literal
isso/tests/test_wsgi.py
test_errorhandler
TestWSGIUtilities
77
null
isso-comments/isso
import tempfile import unittest from os.path import join, dirname from isso import config from isso.db import SQLite3 from isso.migrate import Disqus, WordPress, autodetect, Generic conf = config.new({"general": {"dbpath": "/dev/null", "max-age": "1h"}}) class TestMigration(unittest.TestCase): def test_wordpr...
None)
self.assertEqual
none_literal
isso/tests/test_migration.py
test_wordpress
TestMigration
102
null
isso-comments/isso
import json import tempfile import unittest from werkzeug.wrappers import Response from isso import Isso, core, config from isso.utils import http from fixtures import curl, loads, FakeIP, JSONClient http.curl = curl class TestVote(unittest.TestCase): def setUp(self): self.path = tempfile.NamedTemporar...
num + 1)
self.assertEqual
complex_expr
isso/tests/test_vote.py
testMultipleLikes
TestVote
60
null
isso-comments/isso
import json import unittest from werkzeug.exceptions import BadRequest from werkzeug.test import create_environ from werkzeug.wrappers import Request from isso import error_handler, wsgi from isso.utils import JSONResponse class TestWSGIUtilities(unittest.TestCase): def test_errorhandler(self): """ ...
400)
self.assertEqual
numeric_literal
isso/tests/test_wsgi.py
test_errorhandler
TestWSGIUtilities
72
null
isso-comments/isso
import unittest import os import sqlite3 import tempfile from isso import config from isso.db import SQLite3 class TestDBMigration(unittest.TestCase): def setUp(self): fd, self.path = tempfile.mkstemp() def tearDown(self): os.unlink(self.path) def test_limit_nested_comments(self): ...
rv)
self.assertEqual
variable
isso/tests/test_db.py
test_limit_nested_comments
TestDBMigration
82
null
isso-comments/isso
import unittest import os import sqlite3 import tempfile from isso import config from isso.db import SQLite3 class TestDBMigration(unittest.TestCase): def setUp(self): fd, self.path = tempfile.mkstemp() def tearDown(self): os.unlink(self.path) def test_comment_text_not_null_migration_wit...
(0,))
self.assertEqual
collection
isso/tests/test_db.py
test_comment_text_not_null_migration_with_rollback_after_error
TestDBMigration
231
null
isso-comments/isso
import json import tempfile import unittest from werkzeug.wrappers import Response from isso import Isso, core, config from isso.utils import http from fixtures import curl, loads, FakeIP, JSONClient http.curl = curl class TestVote(unittest.TestCase): def setUp(self): self.path = tempfile.NamedTemporar...
0)
self.assertEqual
numeric_literal
isso/tests/test_vote.py
testZeroLikes
TestVote
37
null
isso-comments/isso
import unittest import io import os from isso import config class TestConfig(unittest.TestCase): def test_parser_with_environment_variables(self): parser = config.IssoParser() parser.read_file( io.StringIO(""" [foo] bar = $TEST_ENV_VAR baz = ${TEST_...
"test_value")
self.assertEqual
string_literal
isso/tests/test_config.py
test_parser_with_environment_variables
TestConfig
54
null
isso-comments/isso
import unittest from isso import utils from isso.utils import parse class TestParse(unittest.TestCase): def test_thread(self): self.assertEqual(parse.thread("asdf"), (None, "Untitled.")) self.assertEqual( parse.thread(""" <html> <head> <title>Fo...
("test", "Test"))
self.assertEqual
collection
isso/tests/test_utils.py
test_thread
TestParse
70
null
isso-comments/isso
import tempfile import unittest from os.path import join, dirname from isso import config from isso.db import SQLite3 from isso.migrate import Disqus, WordPress, autodetect, Generic conf = config.new({"general": {"dbpath": "/dev/null", "max-age": "1h"}}) class TestMigration(unittest.TestCase): def test_wordpr...
8)
self.assertEqual
numeric_literal
isso/tests/test_migration.py
test_wordpress
TestMigration
82
null
isso-comments/isso
import unittest from isso import utils from isso.utils import parse class TestParse(unittest.TestCase): def test_thread(self): self.assertEqual(parse.thread("asdf"), (None, "Untitled.")) self.assertEqual( parse.thread(""" <html> <head> <title>Fo...
(None, "No way!"))
self.assertEqual
collection
isso/tests/test_utils.py
test_thread
TestParse
60
null
isso-comments/isso
import unittest from isso import config from isso.utils.hash import Hash, PBKDF2, new class TestHasher(unittest.TestCase): def test_hash(self): self.assertRaises(
TypeError)
self.assertRaises
variable
isso/tests/test_utils_hash.py
test_hash
TestHasher
12
null
isso-comments/isso
import tempfile import unittest from os.path import join, dirname from isso import config from isso.db import SQLite3 from isso.migrate import Disqus, WordPress, autodetect, Generic conf = config.new({"general": {"dbpath": "/dev/null", "max-age": "1h"}}) class TestMigration(unittest.TestCase): def test_disqus...
5)
self.assertEqual
numeric_literal
isso/tests/test_migration.py
test_disqus_empty_id_workaround
TestMigration
51
null
isso-comments/isso
import json import unittest from werkzeug.exceptions import BadRequest from werkzeug.test import create_environ from werkzeug.wrappers import Request from isso import error_handler, wsgi from isso.utils import JSONResponse class TestWSGIUtilities(unittest.TestCase): def test_urlsplit(self): examples = [ ...
result)
self.assertEqual
variable
isso/tests/test_wsgi.py
test_urlsplit
TestWSGIUtilities
25
null
isso-comments/isso
import json import os import re import tempfile import unittest from urllib.parse import urlencode from werkzeug.wrappers import Response from isso import Isso, core, config from isso.utils import http from isso.views import comments from fixtures import curl, loads, FakeIP, FakeHost, JSONClient http.curl = curl ...
4)
self.assertEqual
numeric_literal
isso/tests/test_comments.py
testCreateInvalidThreadForParent
TestComments
143
null
isso-comments/isso
import unittest import os import sqlite3 import tempfile from isso import config from isso.db import SQLite3 class TestDBMigration(unittest.TestCase): def setUp(self): fd, self.path = tempfile.mkstemp() def tearDown(self): os.unlink(self.path) def test_defaults(self): conf = conf...
SQLite3.MAX_VERSION)
self.assertEqual
complex_expr
isso/tests/test_db.py
test_defaults
TestDBMigration
23
null
isso-comments/isso
import tempfile import unittest from os.path import join, dirname from isso import config from isso.db import SQLite3 from isso.migrate import Disqus, WordPress, autodetect, Generic conf = config.new({"general": {"dbpath": "/dev/null", "max-age": "1h"}}) class TestMigration(unittest.TestCase): def test_disqus...
"peter")
self.assertEqual
string_literal
isso/tests/test_migration.py
test_disqus_empty_id_workaround
TestMigration
58
null
isso-comments/isso
import unittest import io import os from isso import config class TestConfig(unittest.TestCase): def test_parser(self): parser = config.IssoParser() parser.read_file( io.StringIO(""" [foo] bar = 1h baz = 12 spam = a, b, cdef b...
12)
self.assertEqual
numeric_literal
isso/tests/test_config.py
test_parser
TestConfig
27
null
isso-comments/isso
import unittest from isso import config from isso.utils.hash import Hash, PBKDF2, new class TestHasher(unittest.TestCase): def test_hash(self): self.assertRaises(TypeError, Hash, "Foo") self.assertEqual(Hash(b"").salt,
b"")
self.assertEqual
string_literal
isso/tests/test_utils_hash.py
test_hash
TestHasher
14
null
isso-comments/isso
import json import unittest from werkzeug.exceptions import BadRequest from werkzeug.test import create_environ from werkzeug.wrappers import Request from isso import error_handler, wsgi from isso.utils import JSONResponse class TestWSGIUtilities(unittest.TestCase): def test_errorhandler(self): """ ...
JSONResponse)
self.assertIsInstance
variable
isso/tests/test_wsgi.py
test_errorhandler
TestWSGIUtilities
70
null
isso-comments/isso
import unittest import os import sqlite3 import tempfile from isso import config from isso.db import SQLite3 class TestDBMigration(unittest.TestCase): def setUp(self): fd, self.path = tempfile.mkstemp() def tearDown(self): os.unlink(self.path) def test_comment_text_not_null_migration_wit...
"Migrating DB version 4 to 5 failed: no such column: notification")
self.assertEqual
string_literal
isso/tests/test_db.py
test_comment_text_not_null_migration_with_rollback_after_error
TestDBMigration
222
null
isso-comments/isso
import unittest from isso import config from isso.utils.hash import Hash, PBKDF2, new class TestCreate(unittest.TestCase): def test_custom(self): def _new(val): conf = config.new({"hash": {"algorithm": val, "salt": ""}}) return new(conf.section("hash")) sha1 = _new("sha1"...
"sha1")
self.assertEqual
string_literal
isso/tests/test_utils_hash.py
test_custom
TestCreate
48
null
isso-comments/isso
import json import os import re import tempfile import unittest from urllib.parse import urlencode from werkzeug.wrappers import Response from isso import Isso, core, config from isso.utils import http from isso.views import comments from fixtures import curl, loads, FakeIP, FakeHost, JSONClient http.curl = curl ...
1)
self.assertEqual
numeric_literal
isso/tests/test_comments.py
testGet
TestComments
54
null
isso-comments/isso
import unittest import os import sqlite3 import tempfile from isso import config from isso.db import SQLite3 class TestDBMigration(unittest.TestCase): def setUp(self): fd, self.path = tempfile.mkstemp() def tearDown(self): os.unlink(self.path) def test_defaults(self): conf = conf...
db.preferences.get("session-key", "").isalnum())
self.assertTrue
func_call
isso/tests/test_db.py
test_defaults
TestDBMigration
24
null
isso-comments/isso
import json import tempfile import unittest from werkzeug.wrappers import Response from isso import Isso, core, config from isso.utils import http from fixtures import curl, loads, FakeIP, JSONClient http.curl = curl class TestVote(unittest.TestCase): def setUp(self): self.path = tempfile.NamedTemporar...
1)
self.assertEqual
numeric_literal
isso/tests/test_vote.py
testSingleLike
TestVote
45
null
isso-comments/isso
import json import unittest from werkzeug.exceptions import BadRequest from werkzeug.test import create_environ from werkzeug.wrappers import Request from isso import error_handler, wsgi from isso.utils import JSONResponse class TestWSGIUtilities(unittest.TestCase): def test_errorhandler(self): """ ...
BadRequest)
self.assertEqual
variable
isso/tests/test_wsgi.py
test_errorhandler
TestWSGIUtilities
62
null
isso-comments/isso
import unittest import textwrap from isso import config from isso.html import Markup from isso.html.misaka import MisakaMarkdown class TestHTMLMisaka(unittest.TestCase): def test_sanitized_render_extensions(self): """Options should be normalized from both dashed-case or snake_case (legacy)""" con...
convert.render("foo_bar_baz"))
self.assertEqual
func_call
isso/tests/test_html_misaka.py
test_sanitized_render_extensions
TestHTMLMisaka
94
null
isso-comments/isso
import tempfile import unittest from os.path import join, dirname from isso import config from isso.db import SQLite3 from isso.migrate import Disqus, WordPress, autodetect, Generic conf = config.new({"general": {"dbpath": "/dev/null", "max-age": "1h"}}) class TestMigration(unittest.TestCase): def test_detect...
Disqus)
self.assertEqual
variable
isso/tests/test_migration.py
test_detection
TestMigration
151
null
isso-comments/isso
import unittest from isso import config from isso.utils.hash import Hash, PBKDF2, new class TestHasher(unittest.TestCase): def test_hash(self): self.assertRaises(TypeError, Hash, "Foo") self.assertEqual(Hash(b"").salt, b"") self.assertEqual(Hash().salt,
Hash.salt)
self.assertEqual
complex_expr
isso/tests/test_utils_hash.py
test_hash
TestHasher
15
null
isso-comments/isso
import unittest import io import os from isso import config class TestConfig(unittest.TestCase): def test_parser(self): parser = config.IssoParser() parser.read_file( io.StringIO(""" [foo] bar = 1h baz = 12 spam = a, b, cdef b...
"%s%%foo")
self.assertEqual
string_literal
isso/tests/test_config.py
test_parser
TestConfig
33
null
isso-comments/isso
import unittest from isso import config from isso.utils.hash import Hash, PBKDF2, new class TestPBKDF2(unittest.TestCase): def test_default(self): # original setting (and still default) pbkdf2 = PBKDF2(iterations=1000) self.assertEqual(pbkdf2.uhash(""),
"42476aafe2e4")
self.assertEqual
string_literal
isso/tests/test_utils_hash.py
test_default
TestPBKDF2
32
null
isso-comments/isso
import unittest from werkzeug.test import Client from werkzeug.wrappers import Response from isso.wsgi import CORSMiddleware, origin def hello_world(environ, start_response): start_response("200 OK", [("Content-Type", "text/html")]) return ["Hello, World."] class CORSTest(unittest.TestCase): def test_si...
"http://example.tld")
self.assertEqual
string_literal
isso/tests/test_cors.py
test_simple
CORSTest
41
null
isso-comments/isso
import unittest from isso import utils from isso.utils import parse class TestParse(unittest.TestCase): def test_thread(self): self.assertEqual(parse.thread("asdf"),
(None, "Untitled."))
self.assertEqual
collection
isso/tests/test_utils.py
test_thread
TestParse
35
null
isso-comments/isso
import json import tempfile import unittest from werkzeug.wrappers import Response from isso import Isso, core, config from isso.utils import http from fixtures import curl, loads, FakeIP, JSONClient http.curl = curl class TestVote(unittest.TestCase): def setUp(self): self.path = tempfile.NamedTemporar...
None)
self.assertEqual
none_literal
isso/tests/test_vote.py
testVoteOnNonexistentComment
TestVote
65
null
isso-comments/isso
import unittest from isso import config from isso.utils.hash import Hash, PBKDF2, new class TestCreate(unittest.TestCase): def test_custom(self): def _new(val): conf = config.new({"hash": {"algorithm": val, "salt": ""}}) return new(conf.section("hash")) sha1 = _new("sha1"...
"md5")
self.assertEqual
string_literal
isso/tests/test_utils_hash.py
test_custom
TestCreate
58
null
isso-comments/isso
import unittest import textwrap from isso import config from isso.html import Markup from isso.html.misaka import MisakaMarkdown class TestHTMLMisaka(unittest.TestCase): def test_markdown(self): conf = config.new({"markup.misaka": {"options": "", "flags": ""}}) convert = MisakaMarkdown(conf) ...
convert.render(markup))
self.assertEqual
func_call
isso/tests/test_html_misaka.py
test_markdown
TestHTMLMisaka
20
null
isso-comments/isso
import json import unittest from werkzeug.exceptions import BadRequest from werkzeug.test import create_environ from werkzeug.wrappers import Request from isso import error_handler, wsgi from isso.utils import JSONResponse class TestWSGIUtilities(unittest.TestCase): def test_errorhandler(self): """ ...
None)
self.assertEqual
none_literal
isso/tests/test_wsgi.py
test_errorhandler
TestWSGIUtilities
83
null
isso-comments/isso
import unittest import io import os from isso import config class TestConfig(unittest.TestCase): def test_parser_with_missing_environment_variables(self): parser = config.IssoParser() parser.read_file( io.StringIO(""" [foo] bar = $MISSING_ENV_VAR """) ...
"$MISSING_ENV_VAR")
self.assertEqual
string_literal
isso/tests/test_config.py
test_parser_with_missing_environment_variables
TestConfig
75
null
isso-comments/isso
import tempfile import unittest from os.path import join, dirname from isso import config from isso.db import SQLite3 from isso.migrate import Disqus, WordPress, autodetect, Generic conf = config.new({"general": {"dbpath": "/dev/null", "max-age": "1h"}}) class TestMigration(unittest.TestCase): def test_disqus...
"")
self.assertEqual
string_literal
isso/tests/test_migration.py
test_disqus_empty_id_workaround
TestMigration
66
null
isso-comments/isso
import unittest from isso import config from isso.utils.hash import Hash, PBKDF2, new class TestCreate(unittest.TestCase): def test_custom(self): def _new(val): conf = config.new({"hash": {"algorithm": val, "salt": ""}}) return new(conf.section("hash")) sha1 = _new("sha1"...
16)
self.assertEqual
numeric_literal
isso/tests/test_utils_hash.py
test_custom
TestCreate
53
null
isso-comments/isso
import json import os import re import tempfile import unittest from urllib.parse import urlencode from werkzeug.wrappers import Response from isso import Isso, core, config from isso.utils import http from isso.views import comments from fixtures import curl, loads, FakeIP, FakeHost, JSONClient http.curl = curl ...
3)
self.assertEqual
numeric_literal
isso/tests/test_comments.py
testCreateMultiple
TestComments
99
null
isso-comments/isso
import unittest import textwrap from isso import config from isso.html import Markup from isso.html.misaka import MisakaMarkdown class TestHTMLMisaka(unittest.TestCase): def test_github_flavoured_markdown(self): conf = config.new({"markup.misaka": {"options": "fenced-code", "flags": ""}}) convert...
convert.render(_in))
self.assertEqual
func_call
isso/tests/test_html_misaka.py
test_github_flavoured_markdown
TestHTMLMisaka
50
null
isso-comments/isso
import json import unittest from werkzeug.exceptions import BadRequest from werkzeug.test import create_environ from werkzeug.wrappers import Request from isso import error_handler, wsgi from isso.utils import JSONResponse class TestWSGIUtilities(unittest.TestCase): def test_origin(self): self.assertEqu...
"http://foo.bar")
self.assertEqual
string_literal
isso/tests/test_wsgi.py
test_origin
TestWSGIUtilities
41
null
isso-comments/isso
import unittest from werkzeug.test import Client from werkzeug.wrappers import Response from isso.wsgi import CORSMiddleware, origin def hello_world(environ, start_response): start_response("200 OK", [("Content-Type", "text/html")]) return ["Hello, World."] class CORSTest(unittest.TestCase): def test_p...
rv.headers)
self.assertIn
complex_expr
isso/tests/test_cors.py
test_preflight
CORSTest
57
null
isso-comments/isso
import json import unittest from werkzeug.exceptions import BadRequest from werkzeug.test import create_environ from werkzeug.wrappers import Request from isso import error_handler, wsgi from isso.utils import JSONResponse class TestWSGIUtilities(unittest.TestCase): def test_origin(self): self.assertEqu...
"https://foo.bar")
self.assertEqual
string_literal
isso/tests/test_wsgi.py
test_origin
TestWSGIUtilities
42
null
isso-comments/isso
import json import os import re import tempfile import unittest from urllib.parse import urlencode from werkzeug.wrappers import Response from isso import Isso, core, config from isso.utils import http from isso.views import comments from fixtures import curl, loads, FakeIP, FakeHost, JSONClient http.curl = curl ...
2)
self.assertEqual
numeric_literal
isso/tests/test_comments.py
testCreateMultiple
TestComments
98
null
isso-comments/isso
import unittest import os import sqlite3 import tempfile from isso import config from isso.db import SQLite3 class TestDBMigration(unittest.TestCase): def setUp(self): fd, self.path = tempfile.mkstemp() def tearDown(self): os.unlink(self.path) def test_comment_text_not_null_migration_wit...
(4,))
self.assertEqual
collection
isso/tests/test_db.py
test_comment_text_not_null_migration_with_rollback_after_error
TestDBMigration
227
null
isso-comments/isso
import unittest from isso import config from isso.utils.hash import Hash, PBKDF2, new class TestPBKDF2(unittest.TestCase): def test_different_salt(self): a = PBKDF2(b"a", iterations=1) b = PBKDF2(b"b", iterations=1) self.assertNotEqual(a.hash(b""),
b.hash(b""))
self.assertNotEqual
func_call
isso/tests/test_utils_hash.py
test_different_salt
TestPBKDF2
37
null
isso-comments/isso
import unittest from werkzeug.test import Client from werkzeug.wrappers import Response from isso.wsgi import CORSMiddleware, origin def hello_world(environ, start_response): start_response("200 OK", [("Content-Type", "text/html")]) return ["Hello, World."] class CORSTest(unittest.TestCase): def test_si...
"Spam")
self.assertEqual
string_literal
isso/tests/test_cors.py
test_simple
CORSTest
38
null
isso-comments/isso
import unittest from werkzeug.test import Client from werkzeug.wrappers import Response from isso.wsgi import CORSMiddleware, origin def hello_world(environ, start_response): start_response("200 OK", [("Content-Type", "text/html")]) return ["Hello, World."] class CORSTest(unittest.TestCase): def test_si...
"true")
self.assertEqual
string_literal
isso/tests/test_cors.py
test_simple
CORSTest
35
null
isso-comments/isso
import unittest import textwrap from isso import config from isso.html import Markup from isso.html.mistune import MistuneMarkdown class TestHTMLMistune(unittest.TestCase): def test_markdown(self): conf = config.new({"markup.mistune": {"plugins": "", "parameters": ""}}) convert = MistuneMarkdown(c...
convert.render(markup))
self.assertEqual
func_call
isso/tests/test_html_mistune.py
test_markdown
TestHTMLMistune
20
null
isso-comments/isso
import unittest import os import sqlite3 import tempfile from isso import config from isso.db import SQLite3 class TestDBMigration(unittest.TestCase): def setUp(self): fd, self.path = tempfile.mkstemp() def tearDown(self): os.unlink(self.path) def test_comment_add_notification_column_mig...
("notification",))
self.assertEqual
collection
isso/tests/test_db.py
test_comment_add_notification_column_migration
TestDBMigration
111
null
danielgtaylor/python-betterproto
from tests.output_betterproto.enum import ( ArithmeticOperator, Choice, Test, ) def test_repeated_enum_is_comparable_with_int(): assert Test(choices=[Choice.ZERO]).choices == [0] assert Test(choices=[Choice.ONE]).choices == [1] assert Test(choices=[Choice.THREE]).choices == [3] assert Test...
[4]
assert
collection
tests/inputs/enum/test_enum.py
test_repeated_enum_is_comparable_with_int
46
null
danielgtaylor/python-betterproto
import pytest import betterproto from tests.output_betterproto.oneof import ( MixedDrink, Test, ) from tests.output_betterproto_pydantic.oneof import Test as TestPyd from tests.util import get_test_case_json_data def test_oneof_constructor_assign(): message = Test(mixed_drink=MixedDrink(shots=42)) fie...
"mixed_drink"
assert
string_literal
tests/inputs/oneof/test_oneof.py
test_oneof_constructor_assign
32
null
danielgtaylor/python-betterproto
import asyncio import uuid import grpclib import grpclib.client import grpclib.metadata import grpclib.server import pytest from grpclib.testing import ChannelFor from betterproto.grpc.util.async_channel import AsyncChannel from tests.output_betterproto.service import ( DoThingRequest, DoThingResponse, Ge...
metadata["authorization"]
assert
complex_expr
tests/grpc/test_grpclib_client.py
server_side_test
32
null
danielgtaylor/python-betterproto
import pytest from betterproto.plugin.typing_compiler import ( DirectImportTypingCompiler, NoTyping310TypingCompiler, TypingImportTypingCompiler, ) def test_typing_import_typing_compiler(): compiler = TypingImportTypingCompiler() assert compiler.imports() == {} assert compiler.optional("str") ...
{"typing": None}
assert
collection
tests/test_typing_compiler.py
test_typing_import_typing_compiler
47
null
danielgtaylor/python-betterproto
import pickle from copy import ( copy, deepcopy, ) from dataclasses import dataclass from typing import ( Dict, List, ) from unittest.mock import ANY import cachelib import betterproto from betterproto.lib.google import protobuf as google def unpickled(message): return pickle.loads(pickle.dumps(m...
copied
assert
variable
tests/test_pickling.py
test_copyability
164
null
danielgtaylor/python-betterproto
from typing import ( Optional, Tuple, ) import pytest import betterproto @pytest.mark.parametrize( "member, values", [ (Colour.RED, ("RED", 1)), (Colour.GREEN, ("GREEN", 2)), (Colour.BLUE, ("BLUE", 3)), (PURPLE, (None, 4)), ], ) def test_name_values(member: Colour,...
values
assert
variable
tests/test_enum.py
test_name_values
54
null
danielgtaylor/python-betterproto
from datetime import ( datetime, timedelta, timezone, ) import pytest from tests.output_betterproto.timestamp_dict_encode import Test MIN_UTC_OFFSET_MIN = -12 * 60 MAX_UTC_OFFSET_MIN = 14 * 60 timezones = [ timezone(timedelta(minutes=x)) for x in range(MIN_UTC_OFFSET_MIN, MAX_UTC_OFFSET_MIN + 1,...
None
assert
none_literal
tests/inputs/timestamp_dict_encode/test_timestamp_dict_encode.py
test_timezone_aware_datetime_dict_encode
33
null
danielgtaylor/python-betterproto
import pytest from betterproto.casing import ( camel_case, pascal_case, snake_case, ) @pytest.mark.parametrize( ["value", "expected"], [ ("", ""), ("a", "A"), ("foobar", "Foobar"), ("fooBar", "FooBar"), ("FooBar", "FooBar"), ("foo.bar", "FooBar"), ...
expected
assert
variable
tests/test_casing.py
test_pascal_case
37
null
danielgtaylor/python-betterproto
import pickle from copy import ( copy, deepcopy, ) from dataclasses import dataclass from typing import ( Dict, List, ) from unittest.mock import ANY import cachelib import betterproto from betterproto.lib.google import protobuf as google def unpickled(message): return pickle.loads(pickle.dumps(m...
b""
assert
string_literal
tests/test_pickling.py
test_recursive_message
121
null
danielgtaylor/python-betterproto
from typing import ( AsyncIterable, AsyncIterator, ) import pytest from grpclib.testing import ChannelFor from tests.output_betterproto.example_service import ( ExampleRequest, ExampleResponse, TestBase, TestStub, ) @pytest.mark.asyncio async def test_calls_with_different_cardinalities(): ...
example_request.example_integer
assert
complex_expr
tests/inputs/example_service/test_example_service.py
test_calls_with_different_cardinalities
66
null
danielgtaylor/python-betterproto
import pytest import betterproto from tests.output_betterproto.oneof_enum import ( Move, Signal, Test, ) from tests.util import get_test_case_json_data def test_which_one_of_returns_enum_with_default_value(): """ returns first field when it is enum and set with default value """ message = ...
Signal.PASS
assert
complex_expr
tests/inputs/oneof_enum/test_oneof_enum.py
test_which_one_of_returns_enum_with_default_value
23
null
danielgtaylor/python-betterproto
from datetime import ( datetime, timezone, ) import pytest from google.protobuf import json_format from google.protobuf.timestamp_pb2 import Timestamp import betterproto from tests.output_betterproto.google_impl_behavior_equivalence import ( Empty, Foo, Request, Spam, Test, ) from tests.ou...
reference_message.SerializeToString()
assert
func_call
tests/inputs/google_impl_behavior_equivalence/test_google_impl_behavior_equivalence.py
test_empty_message_field
93
null
danielgtaylor/python-betterproto
from tests.output_betterproto.enum import ( ArithmeticOperator, Choice, Test, ) def test_repeated_enum_to_dict(): assert Test(choices=[Choice.ZERO]).to_dict()["choices"] == ["ZERO"] assert Test(choices=[Choice.ONE]).to_dict()["choices"] == ["ONE"] assert Test(choices=[Choice.THREE]).to_dict()[...
["THREE"]
assert
collection
tests/inputs/enum/test_enum.py
test_repeated_enum_to_dict
59
null
danielgtaylor/python-betterproto
from tests.output_betterproto.regression_387 import ( ParentElement, Test, ) def test_regression_387(): el = ParentElement(name="test", elems=[Test(id=0), Test(id=42)]) binary = bytes(el) decoded = ParentElement().parse(binary) assert decoded == el assert decoded.elems ==
[Test(id=0), Test(id=42)]
assert
collection
tests/inputs/regression_387/test_regression_387.py
test_regression_387
12
null
danielgtaylor/python-betterproto
import pytest def test_invalid_field_pydantic(): from pydantic import ValidationError from tests.output_betterproto_pydantic.invalid_field import Test with pytest.raises(
ValidationError)
pytest.raises
variable
tests/inputs/invalid_field/test_invalid_field.py
test_invalid_field_pydantic
16
null
danielgtaylor/python-betterproto
import importlib import json import math import os import sys from collections import namedtuple from types import ModuleType from typing import ( Any, Dict, List, Set, Tuple, ) import pytest import betterproto from tests.inputs import config as test_input_config from tests.mocks import MockChanne...
dict_replace_nans(plugin_instance_from_binary.to_dict())
assert
func_call
tests/test_inputs.py
test_binary_compatibility
221
null
danielgtaylor/python-betterproto
import asyncio import uuid import grpclib import grpclib.client import grpclib.metadata import grpclib.server import pytest from grpclib.testing import ChannelFor from betterproto.grpc.util.async_channel import AsyncChannel from tests.output_betterproto.service import ( DoThingRequest, DoThingResponse, Ge...
request_spy_call_kwargs
assert
variable
tests/grpc/test_grpclib_client.py
test_service_call_high_level_with_overrides
215
null
danielgtaylor/python-betterproto
import pytest from betterproto.compile.importing import ( get_type_reference, parse_source_type_name, ) from betterproto.plugin.typing_compiler import DirectImportTypingCompiler def typing_compiler() -> DirectImportTypingCompiler: """ Generates a simple Direct Import Typing Compiler for testing. "...
'"____Message__"'
assert
string_literal
tests/test_get_ref_type.py
test_reference_root_package_from_deeply_nested_child
372
null
danielgtaylor/python-betterproto
import pytest import betterproto from tests.output_betterproto.oneof import ( MixedDrink, Test, ) from tests.output_betterproto_pydantic.oneof import Test as TestPyd from tests.util import get_test_case_json_data def test_oneof_constructor_assign(): message = Test(mixed_drink=MixedDrink(shots=42)) fie...
42
assert
numeric_literal
tests/inputs/oneof/test_oneof.py
test_oneof_constructor_assign
33
null
danielgtaylor/python-betterproto
import json import sys from copy import ( copy, deepcopy, ) from dataclasses import dataclass from datetime import ( datetime, timedelta, ) from inspect import ( Parameter, signature, ) from typing import ( Dict, List, Optional, ) from unittest.mock import ANY import pytest import ...
False
assert
bool_literal
tests/test_features.py
test_optional_flag
280
null
danielgtaylor/python-betterproto
import pytest from tests.mocks import MockChannel from tests.output_betterproto.googletypes_response_embedded import ( Input, Output, TestStub, ) @pytest.mark.asyncio async def test_service_passes_through_unwrapped_values_embedded_in_response(): """ We do not not need to implement value unwrapping...
16
assert
numeric_literal
tests/inputs/googletypes_response_embedded/test_googletypes_response_embedded.py
test_service_passes_through_unwrapped_values_embedded_in_response
37
null
danielgtaylor/python-betterproto
import asyncio import uuid import grpclib import grpclib.client import grpclib.metadata import grpclib.server import pytest from grpclib.testing import ChannelFor from betterproto.grpc.util.async_channel import AsyncChannel from tests.output_betterproto.service import ( DoThingRequest, DoThingResponse, Ge...
defaults[key]
assert
complex_expr
tests/grpc/test_grpclib_client.py
test_service_call_high_level_with_overrides
221
null
danielgtaylor/python-betterproto
import pytest from tests.mocks import MockChannel from tests.output_betterproto.googletypes_response_embedded import ( Input, Output, TestStub, ) @pytest.mark.asyncio async def test_service_passes_through_unwrapped_values_embedded_in_response(): """ We do not not need to implement value unwrapping...
10.0
assert
numeric_literal
tests/inputs/googletypes_response_embedded/test_googletypes_response_embedded.py
test_service_passes_through_unwrapped_values_embedded_in_response
32
null
danielgtaylor/python-betterproto
from tests.output_betterproto.regression_414 import Test def test_full_cycle(): body = bytes([0, 1]) auth = bytes([2, 3]) sig = [b""] obj = Test(body=body, auth=auth, signatures=sig) decoded = Test().parse(bytes(obj)) assert decoded == obj assert decoded.body == body assert decoded.au...
sig
assert
variable
tests/inputs/regression_414/test_regression_414.py
test_full_cycle
15
null
danielgtaylor/python-betterproto
import pytest from betterproto.plugin.typing_compiler import ( DirectImportTypingCompiler, NoTyping310TypingCompiler, TypingImportTypingCompiler, ) def test_direct_import_typing_compiler(): compiler = DirectImportTypingCompiler() assert compiler.imports() ==
{}
assert
collection
tests/test_typing_compiler.py
test_direct_import_typing_compiler
12
null
danielgtaylor/python-betterproto
import pytest from betterproto.compile.importing import ( get_type_reference, parse_source_type_name, ) from betterproto.plugin.typing_compiler import DirectImportTypingCompiler def typing_compiler() -> DirectImportTypingCompiler: """ Generates a simple Direct Import Typing Compiler for testing. "...
'"child.Message"'
assert
string_literal
tests/test_get_ref_type.py
test_reference_child_package_from_package
191
null
danielgtaylor/python-betterproto
import pytest import betterproto from tests.output_betterproto.oneof import ( MixedDrink, Test, ) from tests.output_betterproto_pydantic.oneof import Test as TestPyd from tests.util import get_test_case_json_data def test_which_name(): message = Test() message.from_json(get_test_case_json_data("oneof"...
("pitier", "Mr. T")
assert
collection
tests/inputs/oneof/test_oneof.py
test_which_name
21
null
danielgtaylor/python-betterproto
import pytest import betterproto from tests.output_betterproto.oneof_enum import ( Move, Signal, Test, ) from tests.util import get_test_case_json_data def test_which_one_of_returns_enum_with_non_default_value(): """ returns first field when it is enum and set with non default value """ me...
("signal", Signal.RESIGN)
assert
collection
tests/inputs/oneof_enum/test_oneof_enum.py
test_which_one_of_returns_enum_with_non_default_value
38
null
danielgtaylor/python-betterproto
from dataclasses import dataclass import pytest import betterproto def test_oneof_pattern_matching(): @dataclass class Sub(betterproto.Message): val: int = betterproto.int32_field(1) @dataclass class Foo(betterproto.Message): bar: int = betterproto.int32_field(1, group="group1") ...
"test2"
assert
string_literal
tests/oneof_pattern_matching.py
test_oneof_pattern_matching
34
null
danielgtaylor/python-betterproto
import asyncio import uuid import grpclib import grpclib.client import grpclib.metadata import grpclib.server import pytest from grpclib.testing import ChannelFor from betterproto.grpc.util.async_channel import AsyncChannel from tests.output_betterproto.service import ( DoThingRequest, DoThingResponse, Ge...
grpclib.Status.UNAUTHENTICATED
assert
complex_expr
tests/grpc/test_grpclib_client.py
test_trailer_only_error_unary_unary
69
null
danielgtaylor/python-betterproto
from tests.output_betterproto.proto3_field_presence_oneof import ( InnerNested, Nested, Test, WithOptional, ) def test_empty_nested(message: Test) -> None: # '0a' => tag 1, length delimited # '00' => length: 0 assert bytes(message) ==
bytearray.fromhex("0a 00")
assert
func_call
tests/inputs/proto3_field_presence_oneof/test_proto3_field_presence_oneof.py
test_empty_nested
17
null
danielgtaylor/python-betterproto
from tests.output_betterproto.enum import ( ArithmeticOperator, Choice, Test, ) def test_enum_is_comparable_with_int(): assert Test(choice=Choice.ZERO).choice ==
0
assert
numeric_literal
tests/inputs/enum/test_enum.py
test_enum_is_comparable_with_int
23
null
danielgtaylor/python-betterproto
import json import sys from copy import ( copy, deepcopy, ) from dataclasses import dataclass from datetime import ( datetime, timedelta, ) from inspect import ( Parameter, signature, ) from typing import ( Dict, List, Optional, ) from unittest.mock import ANY import pytest import ...
""
assert
string_literal
tests/test_features.py
test_oneof_support
152
null
danielgtaylor/python-betterproto
import importlib import json import math import os import sys from collections import namedtuple from types import ModuleType from typing import ( Any, Dict, List, Set, Tuple, ) import pytest import betterproto from tests.inputs import config as test_input_config from tests.mocks import MockChanne...
message2
assert
variable
tests/test_inputs.py
test_message_equality
173
null
danielgtaylor/python-betterproto
from tests.output_betterproto.enum import ( ArithmeticOperator, Choice, Test, ) def test_repeated_enum_to_dict(): assert Test(choices=[Choice.ZERO]).to_dict()["choices"] == ["ZERO"] assert Test(choices=[Choice.ONE]).to_dict()["choices"] == ["ONE"] assert Test(choices=[Choice.THREE]).to_dict()["...
["FOUR"]
assert
collection
tests/inputs/enum/test_enum.py
test_repeated_enum_to_dict
60
null
danielgtaylor/python-betterproto
from typing import ( Any, Callable, Optional, ) import pytest import betterproto.lib.google.protobuf as protobuf from tests.mocks import MockChannel from tests.output_betterproto.googletypes_response import ( Input, TestStub, ) test_cases = [ (TestStub.get_double, protobuf.DoubleValue, 2.5), ...
type(value)
assert
func_call
tests/inputs/googletypes_response/test_googletypes_response.py
test_service_unwraps_response
64
null
danielgtaylor/python-betterproto
import inspect from tests.output_betterproto.service_uppercase import TestStub def test_parameters(): sig = inspect.signature(TestStub.do_thing) assert len(sig.parameters) ==
5
assert
numeric_literal
tests/inputs/service_uppercase/test_service.py
test_parameters
8
null
danielgtaylor/python-betterproto
from dataclasses import dataclass from io import BytesIO from pathlib import Path from shutil import which from subprocess import run from typing import Optional import pytest import betterproto from tests.output_betterproto import ( map, nested, oneof, repeated, repeatedpacked, ) oneof_example =...
EOFError)
pytest.raises
variable
tests/test_streams.py
test_multiple_varints
371
null
danielgtaylor/python-betterproto
from datetime import ( datetime, timezone, ) import pytest from betterproto import _Timestamp @pytest.mark.parametrize( "dt", [ datetime(2023, 10, 11, 9, 41, 12, tzinfo=timezone.utc), datetime.now(timezone.utc), # potential issue with floating point precision: datetime...
dt
assert
variable
tests/test_timestamp.py
test_timestamp_to_datetime_and_back
27
null
danielgtaylor/python-betterproto
import json import sys from copy import ( copy, deepcopy, ) from dataclasses import dataclass from datetime import ( datetime, timedelta, ) from inspect import ( Parameter, signature, ) from typing import ( Dict, List, Optional, ) from unittest.mock import ANY import pytest import ...
1
assert
numeric_literal
tests/test_features.py
test_equality_comparison
679
null
danielgtaylor/python-betterproto
from tests.output_betterproto.regression_414 import Test def test_full_cycle(): body = bytes([0, 1]) auth = bytes([2, 3]) sig = [b""] obj = Test(body=body, auth=auth, signatures=sig) decoded = Test().parse(bytes(obj)) assert decoded == obj assert decoded.body ==
body
assert
variable
tests/inputs/regression_414/test_regression_414.py
test_full_cycle
13
null
danielgtaylor/python-betterproto
import pytest import betterproto from tests.output_betterproto.oneof_enum import ( Move, Signal, Test, ) from tests.util import get_test_case_json_data def test_which_one_of_returns_second_field_when_set(): message = Test() message.from_json(get_test_case_json_data("oneof_enum")[0].json) asser...
("move", Move(x=2, y=3))
assert
collection
tests/inputs/oneof_enum/test_oneof_enum.py
test_which_one_of_returns_second_field_when_set
47
null