repo_id stringclasses 400
values | commit_sha stringclasses 400
values | commit_index int32 0 951 | in_repo_split stringclasses 1
value | cross_repo_split stringclasses 1
value | test_file stringlengths 7 121 | test_function stringlengths 1 108 | assertion_type stringclasses 32
values | difficulty stringclasses 8
values | context_lines int32 3 600 | prefix large_stringlengths 44 113k | target large_stringlengths 1 498 | anchor_sha stringclasses 400
values | anchor_index int32 0 951 | qna_source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_algorithms.py | test_rsa_jwk_private_key_can_recover_prime_factors | assert | complex_expr | 33 | import base64
import json
import pytest
from jwt.algorithms import Algorithm, HMACAlgorithm, NoneAlgorithm, has_crypto
from jwt.exceptions import InvalidKeyError
from jwt.utils import base64url_decode
from .keys import load_ec_pub_key_p_521, load_hmac_key, load_rsa_pub_key
from .utils import crypto_required, key_pat... | parsed_key.q | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_algorithms.py | test_rsa_jwk_private_key_can_recover_prime_factors | assert | complex_expr | 34 | import base64
import json
import pytest
from jwt.algorithms import Algorithm, HMACAlgorithm, NoneAlgorithm, has_crypto
from jwt.exceptions import InvalidKeyError
from jwt.utils import base64url_decode
from .keys import load_ec_pub_key_p_521, load_hmac_key, load_rsa_pub_key
from .utils import crypto_required, key_pat... | parsed_key.dmp1 | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_algorithms.py | test_rsa_jwk_private_key_can_recover_prime_factors | assert | complex_expr | 35 | import base64
import json
import pytest
from jwt.algorithms import Algorithm, HMACAlgorithm, NoneAlgorithm, has_crypto
from jwt.exceptions import InvalidKeyError
from jwt.utils import base64url_decode
from .keys import load_ec_pub_key_p_521, load_hmac_key, load_rsa_pub_key
from .utils import crypto_required, key_pat... | parsed_key.dmq1 | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_algorithms.py | test_none_algorithm_should_throw_exception_if_key_is_not_none | pytest.raises | variable | 19 | import base64
import json
import pytest
from jwt.algorithms import Algorithm, HMACAlgorithm, NoneAlgorithm, has_crypto
from jwt.exceptions import InvalidKeyError
from jwt.utils import base64url_decode
from .keys import load_ec_pub_key_p_521, load_hmac_key, load_rsa_pub_key
from .utils import crypto_required, key_pat... | InvalidKeyError) | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwk.py | test_keyset_with_unknown_alg | assert | numeric_literal | 19 | import json
import pytest
from jwt.algorithms import has_crypto
from jwt.api_jwk import PyJWK, PyJWKSet
from jwt.exceptions import InvalidKeyError, PyJWKError, PyJWKSetError
from .utils import crypto_required, key_path
class TestPyJWKSet:
def test_keyset_with_unknown_alg(self):
# first keyset with unus... | 2 | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwk.py | test_keyset_with_unknown_alg | assert | numeric_literal | 21 | import json
import pytest
from jwt.algorithms import has_crypto
from jwt.api_jwk import PyJWK, PyJWKSet
from jwt.exceptions import InvalidKeyError, PyJWKError, PyJWKSetError
from .utils import crypto_required, key_path
class TestPyJWKSet:
def test_keyset_with_unknown_alg(self):
# first keyset with unus... | 1 | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwk.py | test_should_load_key_ec_p256_from_dict | assert | string_literal | 22 | import json
import pytest
from jwt.algorithms import has_crypto
from jwt.api_jwk import PyJWK, PyJWKSet
from jwt.exceptions import InvalidKeyError, PyJWKError, PyJWKSetError
from .utils import crypto_required, key_path
class TestPyJWK:
@crypto_required
def test_should_load_key_ec_p256_from_dict(self):
... | "EC" | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwk.py | test_should_load_key_from_jwk_data_dict | assert | string_literal | 30 | import json
import pytest
from jwt.algorithms import has_crypto
from jwt.api_jwk import PyJWK, PyJWKSet
from jwt.exceptions import InvalidKeyError, PyJWKError, PyJWKSetError
from .utils import crypto_required, key_path
class TestPyJWK:
@crypto_required
def test_should_load_key_from_jwk_data_dict(self):
... | "RSA" | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwk.py | test_should_load_key_from_jwk_data_dict | assert | string_literal | 32 | import json
import pytest
from jwt.algorithms import has_crypto
from jwt.api_jwk import PyJWK, PyJWKSet
from jwt.exceptions import InvalidKeyError, PyJWKError, PyJWKSetError
from .utils import crypto_required, key_path
class TestPyJWK:
@crypto_required
def test_should_load_key_from_jwk_data_dict(self):
... | "sig" | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwk.py | test_should_load_key_hmac_from_dict | assert | string_literal | 22 | import json
import pytest
from jwt.algorithms import has_crypto
from jwt.api_jwk import PyJWK, PyJWKSet
from jwt.exceptions import InvalidKeyError, PyJWKError, PyJWKSetError
from .utils import crypto_required, key_path
class TestPyJWK:
@crypto_required
def test_should_load_key_hmac_from_dict(self):
... | "oct" | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwk.py | test_should_load_key_okp_without_alg_from_dict | assert | string_literal | 22 | import json
import pytest
from jwt.algorithms import has_crypto
from jwt.api_jwk import PyJWK, PyJWKSet
from jwt.exceptions import InvalidKeyError, PyJWKError, PyJWKSetError
from .utils import crypto_required, key_path
class TestPyJWK:
@crypto_required
def test_should_load_key_okp_without_alg_from_dict(sel... | "OKP" | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jws.py | test_decode_warns_on_unsupported_kwarg | assert | numeric_literal | 43 | import json
from decimal import Decimal
import pytest
from jwt.algorithms import Algorithm, has_crypto
from jwt.api_jws import PyJWS
from jwt.exceptions import (
DecodeError,
InvalidAlgorithmError,
InvalidSignatureError,
InvalidTokenError,
)
from jwt.utils import base64url_decode
from jwt.warnings imp... | 1 | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jws.py | test_encode_with_typ_without_keywords | assert | string_literal | 38 | import json
from decimal import Decimal
import pytest
from jwt.algorithms import Algorithm, has_crypto
from jwt.api_jws import PyJWS
from jwt.exceptions import (
DecodeError,
InvalidAlgorithmError,
InvalidSignatureError,
InvalidTokenError,
)
from jwt.utils import base64url_decode
from jwt.warnings imp... | "bar" | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jws.py | test_encode_detached_content_with_b64_header | assert | bool_literal | 41 | import json
from decimal import Decimal
import pytest
from jwt.algorithms import Algorithm, has_crypto
from jwt.api_jws import PyJWS
from jwt.exceptions import (
DecodeError,
InvalidAlgorithmError,
InvalidSignatureError,
InvalidTokenError,
)
from jwt.utils import base64url_decode
from jwt.warnings imp... | False | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jws.py | test_get_unverified_header_returns_header_values | assert | variable | 39 | import json
from decimal import Decimal
import pytest
from jwt.algorithms import Algorithm, has_crypto
from jwt.api_jws import PyJWS
from jwt.exceptions import (
DecodeError,
InvalidAlgorithmError,
InvalidSignatureError,
InvalidTokenError,
)
from jwt.utils import base64url_decode
from jwt.warnings imp... | header | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jws.py | test_encode_decode | assert | variable | 34 | import json
from decimal import Decimal
import pytest
from jwt.algorithms import Algorithm, has_crypto
from jwt.api_jws import PyJWS
from jwt.exceptions import (
DecodeError,
InvalidAlgorithmError,
InvalidSignatureError,
InvalidTokenError,
)
from jwt.utils import base64url_decode
from jwt.warnings imp... | payload | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jws.py | test_unregister_algo_removes_algorithm | assert | variable | 31 | import json
from decimal import Decimal
import pytest
from jwt.algorithms import Algorithm, has_crypto
from jwt.api_jws import PyJWS
from jwt.exceptions import (
DecodeError,
InvalidAlgorithmError,
InvalidSignatureError,
InvalidTokenError,
)
from jwt.utils import base64url_decode
from jwt.warnings imp... | supported | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jws.py | test_unregister_algo_throws_error_if_not_registered | pytest.raises | variable | 30 | import json
from decimal import Decimal
import pytest
from jwt.algorithms import Algorithm, has_crypto
from jwt.api_jws import PyJWS
from jwt.exceptions import (
DecodeError,
InvalidAlgorithmError,
InvalidSignatureError,
InvalidTokenError,
)
from jwt.utils import base64url_decode
from jwt.warnings imp... | KeyError) | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jws.py | test_custom_json_encoder | pytest.raises | variable | 38 | import json
from decimal import Decimal
import pytest
from jwt.algorithms import Algorithm, has_crypto
from jwt.api_jws import PyJWS
from jwt.exceptions import (
DecodeError,
InvalidAlgorithmError,
InvalidSignatureError,
InvalidTokenError,
)
from jwt.utils import base64url_decode
from jwt.warnings imp... | TypeError) | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jws.py | test_encode_headers_parameter_adds_headers | assert | variable | 44 | import json
from decimal import Decimal
import pytest
from jwt.algorithms import Algorithm, has_crypto
from jwt.api_jws import PyJWS
from jwt.exceptions import (
DecodeError,
InvalidAlgorithmError,
InvalidSignatureError,
InvalidTokenError,
)
from jwt.utils import base64url_decode
from jwt.warnings imp... | header_obj | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwt.py | test_decode_warns_on_unsupported_kwarg | assert | numeric_literal | 40 | import json
import time
from calendar import timegm
from datetime import datetime, timedelta, timezone
from decimal import Decimal
import pytest
from jwt.api_jwt import PyJWT
from jwt.exceptions import (
DecodeError,
ExpiredSignatureError,
ImmatureSignatureError,
InvalidAudienceError,
InvalidIssue... | 1 | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwt.py | test_decode_raises_exception_if_aud_is_none | assert | none_literal | 42 | import json
import time
from calendar import timegm
from datetime import datetime, timedelta, timezone
from decimal import Decimal
import pytest
from jwt.api_jwt import PyJWT
from jwt.exceptions import (
DecodeError,
ExpiredSignatureError,
ImmatureSignatureError,
InvalidAudienceError,
InvalidIssue... | None | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwt.py | test_raise_exception_token_without_issuer | assert | string_literal | 44 | import json
import time
from calendar import timegm
from datetime import datetime, timedelta, timezone
from decimal import Decimal
import pytest
from jwt.api_jwt import PyJWT
from jwt.exceptions import (
DecodeError,
ExpiredSignatureError,
ImmatureSignatureError,
InvalidAudienceError,
InvalidIssue... | "iss" | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwt.py | test_raise_exception_token_without_audience | assert | string_literal | 41 | import json
import time
from calendar import timegm
from datetime import datetime, timedelta, timezone
from decimal import Decimal
import pytest
from jwt.api_jwt import PyJWT
from jwt.exceptions import (
DecodeError,
ExpiredSignatureError,
ImmatureSignatureError,
InvalidAudienceError,
InvalidIssue... | "aud" | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwt.py | test_decode_should_raise_error_if_exp_required_but_not_present | assert | string_literal | 49 | import json
import time
from calendar import timegm
from datetime import datetime, timedelta, timezone
from decimal import Decimal
import pytest
from jwt.api_jwt import PyJWT
from jwt.exceptions import (
DecodeError,
ExpiredSignatureError,
ImmatureSignatureError,
InvalidAudienceError,
InvalidIssue... | "exp" | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwt.py | test_decode_should_raise_error_if_iat_required_but_not_present | assert | string_literal | 49 | import json
import time
from calendar import timegm
from datetime import datetime, timedelta, timezone
from decimal import Decimal
import pytest
from jwt.api_jwt import PyJWT
from jwt.exceptions import (
DecodeError,
ExpiredSignatureError,
ImmatureSignatureError,
InvalidAudienceError,
InvalidIssue... | "iat" | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwt.py | test_decode_should_raise_error_if_nbf_required_but_not_present | assert | string_literal | 49 | import json
import time
from calendar import timegm
from datetime import datetime, timedelta, timezone
from decimal import Decimal
import pytest
from jwt.api_jwt import PyJWT
from jwt.exceptions import (
DecodeError,
ExpiredSignatureError,
ImmatureSignatureError,
InvalidAudienceError,
InvalidIssue... | "nbf" | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwt.py | test_decode_with_expiration_with_leeway | assert | variable | 44 | import json
import time
from calendar import timegm
from datetime import datetime, timedelta, timezone
from decimal import Decimal
import pytest
from jwt.api_jwt import PyJWT
from jwt.exceptions import (
DecodeError,
ExpiredSignatureError,
ImmatureSignatureError,
InvalidAudienceError,
InvalidIssue... | payload | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwt.py | test_decode_with_invalid_audience_param_throws_exception | pytest.raises | variable | 42 | import json
import time
from calendar import timegm
from datetime import datetime, timedelta, timezone
from decimal import Decimal
import pytest
from jwt.api_jwt import PyJWT
from jwt.exceptions import (
DecodeError,
ExpiredSignatureError,
ImmatureSignatureError,
InvalidAudienceError,
InvalidIssue... | TypeError) | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwt.py | test_encode_with_typ | assert | variable | 57 | import json
import time
from calendar import timegm
from datetime import datetime, timedelta, timezone
from decimal import Decimal
import pytest
from jwt.api_jwt import PyJWT
from jwt.exceptions import (
DecodeError,
ExpiredSignatureError,
ImmatureSignatureError,
InvalidAudienceError,
InvalidIssue... | header_obj | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwt.py | test_decode_invalid_payload_string | pytest.raises | variable | 42 | import json
import time
from calendar import timegm
from datetime import datetime, timedelta, timezone
from decimal import Decimal
import pytest
from jwt.api_jwt import PyJWT
from jwt.exceptions import (
DecodeError,
ExpiredSignatureError,
ImmatureSignatureError,
InvalidAudienceError,
InvalidIssue... | DecodeError) | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_api_jwt.py | test_decode_no_options_mutation | assert | variable | 40 | import json
import time
from calendar import timegm
from datetime import datetime, timedelta, timezone
from decimal import Decimal
import pytest
from jwt.api_jwt import PyJWT
from jwt.exceptions import (
DecodeError,
ExpiredSignatureError,
ImmatureSignatureError,
InvalidAudienceError,
InvalidIssue... | orig_options | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_compressed_jwt.py | test_decodes_complete_valid_jwt_with_compressed_payload | assert | collection | 22 | import json
import zlib
from jwt import PyJWT
def test_decodes_complete_valid_jwt_with_compressed_payload():
# Test case from https://github.com/jpadilla/pyjwt/pull/753/files
example_payload = {"hello": "world"}
example_secret = "secret"
# payload made with the pako (https://nodeca.github.io/pako/) li... | { "header": {"alg": "HS256", "typ": "JWT"}, "payload": example_payload, "signature": ( b"\xd3\xcc\x07a\xeb\xa1\xd6\xb2W\x99\xc0\\2\xbc\xfa7" b"\x19\x9b\xc4\t\xc2B\x9d\xab\x192\x9fD\xd2$\xc6," ), } | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_exceptions.py | test_missing_required_claim_error_has_proper_str | assert | string_literal | 7 | from jwt.exceptions import MissingRequiredClaimError
def test_missing_required_claim_error_has_proper_str():
exc = MissingRequiredClaimError("abc")
assert str(exc) == | 'Token is missing the "abc" claim' | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_jwks_client.py | test_fetch_data_forwards_headers_to_correct_url | assert | numeric_literal | 87 | import contextlib
import json
import time
from unittest import mock
from urllib.error import URLError
import pytest
import jwt
from jwt import PyJWKClient
from jwt.api_jwk import PyJWK
from jwt.exceptions import PyJWKClientError
from .utils import crypto_required
RESPONSE_DATA_WITH_MATCHING_KID = {
"keys": [
... | 1 | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_jwks_client.py | test_get_signing_key_caches_result | assert | numeric_literal | 91 | import contextlib
import json
import time
from unittest import mock
from urllib.error import URLError
import pytest
import jwt
from jwt import PyJWKClient
from jwt.api_jwk import PyJWK
from jwt.exceptions import PyJWKClientError
from .utils import crypto_required
RESPONSE_DATA_WITH_MATCHING_KID = {
"keys": [
... | 0 | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_jwks_client.py | test_get_jwt_set_refresh_cache | assert | numeric_literal | 90 | import contextlib
import json
import time
from unittest import mock
from urllib.error import URLError
import pytest
import jwt
from jwt import PyJWKClient
from jwt.api_jwk import PyJWK
from jwt.exceptions import PyJWKClientError
from .utils import crypto_required
RESPONSE_DATA_WITH_MATCHING_KID = {
"keys": [
... | 2 | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_jwks_client.py | test_fetch_data_forwards_headers_to_correct_url | assert | variable | 84 | import contextlib
import json
import time
from unittest import mock
from urllib.error import URLError
import pytest
import jwt
from jwt import PyJWKClient
from jwt.api_jwk import PyJWK
from jwt.exceptions import PyJWKClientError
from .utils import crypto_required
RESPONSE_DATA_WITH_MATCHING_KID = {
"keys": [
... | url | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_jwks_client.py | test_get_signing_key | assert | variable | 87 | import contextlib
import json
import time
from unittest import mock
from urllib.error import URLError
import pytest
import jwt
from jwt import PyJWKClient
from jwt.api_jwk import PyJWK
from jwt.exceptions import PyJWKClientError
from .utils import crypto_required
RESPONSE_DATA_WITH_MATCHING_KID = {
"keys": [
... | kid | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_jwks_client.py | test_get_jwk_set_caches_result | assert | none_literal | 81 | import contextlib
import json
import time
from unittest import mock
from urllib.error import URLError
import pytest
import jwt
from jwt import PyJWKClient
from jwt.api_jwk import PyJWK
from jwt.exceptions import PyJWKClientError
from .utils import crypto_required
RESPONSE_DATA_WITH_MATCHING_KID = {
"keys": [
... | None | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_jwks_client.py | test_get_signing_key | assert | string_literal | 86 | import contextlib
import json
import time
from unittest import mock
from urllib.error import URLError
import pytest
import jwt
from jwt import PyJWKClient
from jwt.api_jwk import PyJWK
from jwt.exceptions import PyJWKClientError
from .utils import crypto_required
RESPONSE_DATA_WITH_MATCHING_KID = {
"keys": [
... | "RSA" | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_jwks_client.py | test_get_signing_key | assert | string_literal | 88 | import contextlib
import json
import time
from unittest import mock
from urllib.error import URLError
import pytest
import jwt
from jwt import PyJWKClient
from jwt.api_jwk import PyJWK
from jwt.exceptions import PyJWKClientError
from .utils import crypto_required
RESPONSE_DATA_WITH_MATCHING_KID = {
"keys": [
... | "sig" | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_jwks_client.py | test_fetch_data_forwards_headers_to_correct_url | assert | variable | 85 | import contextlib
import json
import time
from unittest import mock
from urllib.error import URLError
import pytest
import jwt
from jwt import PyJWKClient
from jwt.api_jwk import PyJWK
from jwt.exceptions import PyJWKClientError
from .utils import crypto_required
RESPONSE_DATA_WITH_MATCHING_KID = {
"keys": [
... | custom_headers | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_jwt.py | test_encode_decode | assert | variable | 19 | import jwt
from .utils import utc_timestamp
def test_encode_decode():
"""
This test exists primarily to ensure that calls to jwt.encode and
jwt.decode don't explode. Most functionality is tested by the PyJWT class
tests. This is primarily a sanity check to make sure we don't break the
public globa... | payload | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_utils.py | test_to_base64url_uint | assert | variable | 19 | import pytest
from jwt.utils import force_bytes, from_base64url_uint, to_base64url_uint
@pytest.mark.parametrize(
"inputval,expected",
[
(0, b"AA"),
(1, b"AQ"),
(255, b"_w"),
(65537, b"AQAB"),
(123456789, b"B1vNFQ"),
pytest.param(-1, "", marks=pytest.mark.xfail(... | expected | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpadilla/pyjwt | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | train | train | tests/test_utils.py | test_force_bytes_raises_error_on_invalid_object | pytest.raises | variable | 7 | import pytest
from jwt.utils import force_bytes, from_base64url_uint, to_base64url_uint
def test_force_bytes_raises_error_on_invalid_object():
with pytest.raises( | TypeError) | 2fc6aa3ffecb54325d44ef076d4eff7418e97a81 | 143 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_catalog.py | test_add_same_folder_in_same_prefix_does_nothing | assert | numeric_literal | 11 | import pytest
import jinjax
def test_add_same_folder_in_same_prefix_does_nothing():
catalog = jinjax.Catalog()
catalog.add_folder("file_path", prefix="custom")
catalog.add_folder("file_path", prefix="custom")
assert catalog.prefixes["custom"].searchpath.count("file_path") == | 1 | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_catalog.py | test_add_module_fails_with_other_modules | pytest.raises | variable | 12 | import pytest
import jinjax
def test_add_module_fails_with_other_modules():
class Module:
pass
catalog = jinjax.Catalog()
module = Module()
with pytest.raises( | AttributeError) | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_catalog.py | test_add_folder_with_dirty_prefix | assert | complex_expr | 10 | import pytest
import jinjax
def test_add_folder_with_dirty_prefix():
catalog = jinjax.Catalog()
catalog.add_folder("file_path", prefix="/custom.")
assert "/custom." not in | catalog.prefixes | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_catalog.py | test_add_folder_with_default_prefix | assert | complex_expr | 10 | import pytest
import jinjax
def test_add_folder_with_default_prefix():
catalog = jinjax.Catalog()
catalog.add_folder("file_path")
assert "file_path" in | catalog.prefixes[""].searchpath | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_catalog.py | test_add_folder_with_custom_prefix | assert | complex_expr | 10 | import pytest
import jinjax
def test_add_folder_with_custom_prefix():
catalog = jinjax.Catalog()
catalog.add_folder("file_path", prefix="custom")
assert "file_path" in | catalog.prefixes["custom"].searchpath | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_catalog.py | test_add_module_legacy | assert | complex_expr | 14 | import pytest
import jinjax
def test_add_module_legacy():
class Module:
components_path = "legacy_path"
catalog = jinjax.Catalog()
module = Module()
catalog.add_module(module, prefix="legacy")
assert "legacy_path" in | catalog.prefixes["legacy"].searchpath | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_component.py | test_expression_args | assert | collection | 11 | import pytest
from jinjax import Component, DuplicateDefDeclaration, InvalidArgument
def test_expression_args():
com = Component(
name="Test.jinja",
source="{#def expr=1 + 2 + 3, a=1 -#}\n",
)
assert com.required == | [] | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_component.py | test_no_args | assert | collection | 12 | import pytest
from jinjax import Component, DuplicateDefDeclaration, InvalidArgument
def test_no_args():
com = Component(
name="Test.jinja",
source="\n",
)
assert com.required == []
assert com.optional == | {} | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_component.py | test_comment_after_args_decl | assert | collection | 19 | import pytest
from jinjax import Component, DuplicateDefDeclaration, InvalidArgument
def test_comment_after_args_decl():
com = Component(
name="Test.jinja",
source="""
{# def
arg,
#}
{#
Some comment.
#}
Hi
""".strip())
assert com.required == | ["arg"] | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_component.py | test_load_metadata_in_any_order | assert | collection | 18 | import pytest
from jinjax import Component, DuplicateDefDeclaration, InvalidArgument
def test_load_metadata_in_any_order():
com = Component(
name="Test.jinja",
source="""
{#css a.css #}
{#def lorem, ipsum=4 #}
{#js a.js #}
""",
)
assert com.required == ["lor... | ["a.js"] | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_component.py | test_load_metadata_in_any_order | assert | collection | 15 | import pytest
from jinjax import Component, DuplicateDefDeclaration, InvalidArgument
def test_load_metadata_in_any_order():
com = Component(
name="Test.jinja",
source="""
{#css a.css #}
{#def lorem, ipsum=4 #}
{#js a.js #}
""",
)
assert com.required == | ["lorem"] | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_component.py | test_load_metadata_in_any_order | assert | collection | 17 | import pytest
from jinjax import Component, DuplicateDefDeclaration, InvalidArgument
def test_load_metadata_in_any_order():
com = Component(
name="Test.jinja",
source="""
{#css a.css #}
{#def lorem, ipsum=4 #}
{#js a.js #}
""",
)
assert com.required == ["lor... | ["a.css"] | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_component.py | test_load_args | assert | collection | 11 | import pytest
from jinjax import Component, DuplicateDefDeclaration, InvalidArgument
def test_load_args():
com = Component(
name="Test.jinja",
source='{#def message, lorem=4, ipsum="bar" -#}\n',
)
assert com.required == | ["message"] | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_component.py | test_load_metadata_in_any_order | assert | collection | 16 | import pytest
from jinjax import Component, DuplicateDefDeclaration, InvalidArgument
def test_load_metadata_in_any_order():
com = Component(
name="Test.jinja",
source="""
{#css a.css #}
{#def lorem, ipsum=4 #}
{#js a.js #}
""",
)
assert com.required == ["lor... | {"ipsum": 4} | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_html_attrs.py | test_parse_initial_attrs | assert | numeric_literal | 32 | import pytest
from jinjax.html_attrs import HTMLAttrs
def test_parse_initial_attrs():
attrs = HTMLAttrs(
{
"title": "hi",
"data-position": "top",
"class": "z4 c3 a1 z4 b2",
"open": True,
"disabled": False,
"value": 0,
"foo... | 0 | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_html_attrs.py | test_parse_initial_attrs | assert | string_literal | 25 | import pytest
from jinjax.html_attrs import HTMLAttrs
def test_parse_initial_attrs():
attrs = HTMLAttrs(
{
"title": "hi",
"data-position": "top",
"class": "z4 c3 a1 z4 b2",
"open": True,
"disabled": False,
"value": 0,
"foo... | "0" | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_html_attrs.py | test_parse_initial_attrs | assert | string_literal | 22 | import pytest
from jinjax.html_attrs import HTMLAttrs
def test_parse_initial_attrs():
attrs = HTMLAttrs(
{
"title": "hi",
"data-position": "top",
"class": "z4 c3 a1 z4 b2",
"open": True,
"disabled": False,
"value": 0,
"foo... | "hi" | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_html_attrs.py | test_parse_initial_attrs | assert | bool_literal | 23 | import pytest
from jinjax.html_attrs import HTMLAttrs
def test_parse_initial_attrs():
attrs = HTMLAttrs(
{
"title": "hi",
"data-position": "top",
"class": "z4 c3 a1 z4 b2",
"open": True,
"disabled": False,
"value": 0,
"foo... | True | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_html_attrs.py | test_parse_initial_attrs | assert | none_literal | 27 | import pytest
from jinjax.html_attrs import HTMLAttrs
def test_parse_initial_attrs():
attrs = HTMLAttrs(
{
"title": "hi",
"data-position": "top",
"class": "z4 c3 a1 z4 b2",
"open": True,
"disabled": False,
"value": 0,
"foo... | None | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_html_attrs.py | test_class_management | assert | string_literal | 21 | import pytest
from jinjax.html_attrs import HTMLAttrs
def test_class_management():
attrs = HTMLAttrs(
{
"class": "z4 c3 a1 z4 b2",
}
)
attrs.set(classes="lorem bipsum lorem a1")
assert attrs.classes == "a1 b2 bipsum c3 lorem z4"
attrs.remove_class("bipsum")
assert... | "meh" | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_html_attrs.py | test_render_attrs_lik_set | assert | variable | 16 | import pytest
from jinjax.html_attrs import HTMLAttrs
def test_render_attrs_lik_set():
attrs = HTMLAttrs({"class": "lorem"})
expected = 'class="ipsum lorem" data-position="top" title="hi" open'
result = attrs.render(
title="hi",
data_position="top",
classes="ipsum",
open=Tr... | result | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_html_attrs.py | test_additional_attributes_lazily_evaluated_has_string_methods | assert | string_literal | 79 | import pytest
from jinjax.html_attrs import HTMLAttrs
def test_additional_attributes_lazily_evaluated_has_string_methods():
class TestObject:
def __str__(self):
return "test"
attrs = HTMLAttrs({"some_object": TestObject()})
assert attrs["some_object"].__str__
assert attrs["some_o... | "TEST" | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_html_attrs.py | test_additional_attributes_lazily_evaluated_has_string_methods | assert | string_literal | 80 | import pytest
from jinjax.html_attrs import HTMLAttrs
def test_additional_attributes_lazily_evaluated_has_string_methods():
class TestObject:
def __str__(self):
return "test"
attrs = HTMLAttrs({"some_object": TestObject()})
assert attrs["some_object"].__str__
assert attrs["some_o... | "Test" | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_html_attrs.py | test_getattr | assert | string_literal | 14 | import pytest
from jinjax.html_attrs import HTMLAttrs
def test_getattr():
attrs = HTMLAttrs(
{
"title": "hi",
"class": "z4 c3 a1 z4 b2",
"open": True,
}
)
assert attrs["class"] == | "a1 b2 c3 z4" | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_html_attrs.py | test_additional_attributes_are_lazily_evaluated_to_strings | pytest.raises | variable | 17 | import pytest
from jinjax.html_attrs import HTMLAttrs
def test_additional_attributes_are_lazily_evaluated_to_strings():
class TestObject:
def __str__(self):
raise RuntimeError("Should not be called unless rendered.")
attrs = HTMLAttrs(
{
"some_object": TestObject(),
... | RuntimeError) | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_html_attrs.py | test_render | assert | func_call | 16 | import pytest
from jinjax.html_attrs import HTMLAttrs
def test_render():
attrs = HTMLAttrs(
{
"title": "hi",
"data-position": "top",
"class": "z4 c3 a1 z4 b2",
"open": True,
"disabled": False,
}
)
assert 'class="a1 b2 c3 z4" data... | attrs.render() | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_middleware.py | test_add_custom_extensions | assert | string_literal | 37 | import typing as t
from pathlib import Path
import jinjax
def application(environ, start_response) -> list[bytes]:
status = "200 OK"
headers = [("Content-type", "text/plain")]
start_response(status, headers)
return [b"NOPE"]
def make_environ(**kw) -> dict[str, t.Any]:
kw.setdefault("PATH_INFO", "... | b"???" | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_middleware.py | test_other_file_extensions_ignored | assert | collection | 34 | import typing as t
from pathlib import Path
import jinjax
def application(environ, start_response) -> list[bytes]:
status = "200 OK"
headers = [("Content-type", "text/plain")]
start_response(status, headers)
return [b"NOPE"]
def make_environ(**kw) -> dict[str, t.Any]:
kw.setdefault("PATH_INFO", "... | [b"NOPE"] | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_middleware.py | test_multiple_folders | assert | string_literal | 44 | import typing as t
from pathlib import Path
import jinjax
def application(environ, start_response) -> list[bytes]:
status = "200 OK"
headers = [("Content-type", "text/plain")]
start_response(status, headers)
return [b"NOPE"]
def make_environ(**kw) -> dict[str, t.Any]:
kw.setdefault("PATH_INFO", "... | b"folder1" | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_middleware.py | test_multiple_folders | assert | string_literal | 46 | import typing as t
from pathlib import Path
import jinjax
def application(environ, start_response) -> list[bytes]:
status = "200 OK"
headers = [("Content-type", "text/plain")]
start_response(status, headers)
return [b"NOPE"]
def make_environ(**kw) -> dict[str, t.Any]:
kw.setdefault("PATH_INFO", "... | b"folder2" | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_middleware.py | test_js_is_returned | assert | string_literal | 37 | import typing as t
from pathlib import Path
import jinjax
def application(environ, start_response) -> list[bytes]:
status = "200 OK"
headers = [("Content-type", "text/plain")]
start_response(status, headers)
return [b"NOPE"]
def make_environ(**kw) -> dict[str, t.Any]:
kw.setdefault("PATH_INFO", "... | b"/* Page.js */" | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_middleware.py | test_css_is_returned | assert | string_literal | 37 | import typing as t
from pathlib import Path
import jinjax
def application(environ, start_response) -> list[bytes]:
status = "200 OK"
headers = [("Content-type", "text/plain")]
start_response(status, headers)
return [b"NOPE"]
def make_environ(**kw) -> dict[str, t.Any]:
kw.setdefault("PATH_INFO", "... | b"/* Page.css */" | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_prefix.py | test_prefix_namespace | assert | func_call | 19 | import pytest
from markupsafe import Markup
@pytest.mark.parametrize("autoescape", [True, False])
def test_prefix_namespace(catalog, folder, folder_t, autoescape):
"""Components mounted with a prefix should be able to import other components
from the same folder without specifying the prefix.
"""
catal... | Markup("prefix") | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_prefix.py | test_prefix_fallback | assert | func_call | 17 | import pytest
from markupsafe import Markup
@pytest.mark.parametrize("autoescape", [True, False])
def test_prefix_fallback(catalog, folder, folder_t, autoescape):
"""If a component is not found in the folder with the prefix, it should
fallback to the no-prefix folders.
"""
catalog.jinja_env.autoescape ... | Markup("parent") | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_prefix.py | test_prefix_namespace_sub | assert | func_call | 25 | import pytest
from markupsafe import Markup
@pytest.mark.parametrize("autoescape", [True, False])
def test_prefix_namespace_sub(catalog, folder, folder_t, autoescape):
"""Components mounted with a prefix should be able to import other components
from the same folder without specifying the prefix, even if those... | Markup("sub/prefix") | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_prefix.py | test_prefix_namespace_assets | assert | func_call | 22 | import pytest
from markupsafe import Markup
@pytest.mark.parametrize("autoescape", [True, False])
def test_prefix_namespace_assets(catalog, folder, folder_t, autoescape):
"""Components import without specifying the prefix should also be
able to auto-import their assets.
"""
catalog.jinja_env.autoescape... | Markup(""" <link rel="stylesheet" href="/static/components/ui/Title.css"> prefix """.strip()) | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_render.py | test_render_source | assert | variable | 20 | import time
from textwrap import dedent
import jinja2
import pytest
from jinja2.exceptions import TemplateSyntaxError
from markupsafe import Markup
import jinjax
@pytest.mark.parametrize("autoescape", [True, False])
def test_render_source(catalog, autoescape):
catalog.jinja_env.autoescape = autoescape
sourc... | html | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_render.py | test_do_not_mess_with_external_jinja_env | assert | string_literal | 40 | import time
from textwrap import dedent
import jinja2
import pytest
from jinja2.exceptions import TemplateSyntaxError
from markupsafe import Markup
import jinjax
@pytest.mark.parametrize("autoescape", [True, False])
def test_do_not_mess_with_external_jinja_env(folder_t, folder, autoescape):
"""https://github.com... | "bar" | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_render.py | test_do_not_mess_with_external_jinja_env | assert | string_literal | 41 | import time
from textwrap import dedent
import jinja2
import pytest
from jinja2.exceptions import TemplateSyntaxError
from markupsafe import Markup
import jinjax
@pytest.mark.parametrize("autoescape", [True, False])
def test_do_not_mess_with_external_jinja_env(folder_t, folder, autoescape):
"""https://github.com... | "foo" | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_render.py | test_auto_reload | assert | variable | 35 | import time
from textwrap import dedent
import jinja2
import pytest
from jinja2.exceptions import TemplateSyntaxError
from markupsafe import Markup
import jinjax
@pytest.mark.parametrize("autoescape", [True, False])
def test_auto_reload(catalog, folder, autoescape):
catalog.jinja_env.autoescape = autoescape
... | html1 | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_render.py | test_auto_reload | assert | variable | 60 | import time
from textwrap import dedent
import jinja2
import pytest
from jinja2.exceptions import TemplateSyntaxError
from markupsafe import Markup
import jinjax
@pytest.mark.parametrize("autoescape", [True, False])
def test_auto_reload(catalog, folder, autoescape):
catalog.jinja_env.autoescape = autoescape
... | html2 | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_render.py | test_auto_reload | assert | variable | 61 | import time
from textwrap import dedent
import jinja2
import pytest
from jinja2.exceptions import TemplateSyntaxError
from markupsafe import Markup
import jinjax
@pytest.mark.parametrize("autoescape", [True, False])
def test_auto_reload(catalog, folder, autoescape):
catalog.jinja_env.autoescape = autoescape
... | html3 | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_render_assets.py | test_render_assets | assert | variable | 54 | from pathlib import Path
import pytest
from markupsafe import Markup
@pytest.mark.parametrize("autoescape", [True, False])
def test_render_assets(catalog, folder, autoescape):
catalog.jinja_env.autoescape = autoescape
(folder / "Greeting.jinja").write_text(
"""
{#def message #}
{#css greeting.css, ht... | html | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_render_assets.py | test_auto_load_assets_with_same_name | assert | func_call | 48 | from pathlib import Path
import pytest
from markupsafe import Markup
@pytest.mark.parametrize("autoescape", [True, False])
def test_auto_load_assets_with_same_name(catalog, folder, autoescape):
catalog.jinja_env.autoescape = autoescape
(folder / "Layout.jinja").write_text(
"""{{ catalog.render_assets... | Markup(expected) | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_thread_safety.py | test_thread_safety_of_template_globals | assert | func_call | 27 | from threading import Thread
from markupsafe import Markup
import jinjax
def test_thread_safety_of_template_globals(catalog, folder):
NUM_THREADS = 5
(folder / "Page.jinja").write_text(
"{{ globalvar if globalvar is defined else 'not set' }}"
)
def render(i):
return catalog.render("P... | Markup(str(i)) | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_thread_safety.py | test_thread_safety_of_render_assets | assert | func_call | 67 | from threading import Thread
from markupsafe import Markup
import jinjax
def test_thread_safety_of_render_assets(catalog, folder):
NUM_THREADS = 5
child_tmpl = """
{#css "c{i}.css" #}
{#js "c{i}.js" #}
<p>Child {i}</p>""".strip()
parent_tmpl = """
{{ catalog.render_assets() }}
{{ content }}""".strip()
... | Markup(expected) | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_thread_safety.py | test_same_thread_assets_independence | assert | func_call | 76 | from threading import Thread
from markupsafe import Markup
import jinjax
def test_same_thread_assets_independence(catalog, folder):
catalog2 = jinjax.Catalog()
catalog2.add_folder(folder)
print("Catalog1 key:", catalog._key)
print("Catalog2 key:", catalog2._key)
# Check if the context variables... | Markup(expected_1) | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jpsca/jinjax | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | train | train | tests/test_thread_safety.py | test_same_thread_assets_independence | assert | func_call | 77 | from threading import Thread
from markupsafe import Markup
import jinjax
def test_same_thread_assets_independence(catalog, folder):
catalog2 = jinjax.Catalog()
catalog2.add_folder(folder)
print("Catalog1 key:", catalog._key)
print("Catalog2 key:", catalog2._key)
# Check if the context variables... | Markup(expected_2) | 7fd9b36809f4c851e11c84353c5cf175db439b50 | 51 | v2_extractor_at_anchor |
jrobichaud/django-structlog | c0c333b15e56ccc28ee459fb046ced74e4ff44a2 | 63 | train | train | django_structlog_demo_project/command_examples/tests/test_commands.py | test_command | assert | none_literal | 13 | import pytest
from django.core import management
from django_structlog_demo_project.command_examples.management.commands import (
example_command,
)
pytestmark = pytest.mark.django_db
class TestCommand:
def test_command(self):
assert | None | c0c333b15e56ccc28ee459fb046ced74e4ff44a2 | 63 | v2_extractor_at_anchor |
jrobichaud/django-structlog | c0c333b15e56ccc28ee459fb046ced74e4ff44a2 | 63 | train | train | django_structlog_demo_project/home/tests/test_api_views.py | test | assert | numeric_literal | 12 | import pytest
from .. import api_views
pytestmark = pytest.mark.django_db
class TestApiView:
def test(self, caplog, request_factory):
response = api_views.home_api_view(request_factory.get("/"))
assert response.status_code == 200
assert len(caplog.records) == | 1 | c0c333b15e56ccc28ee459fb046ced74e4ff44a2 | 63 | v2_extractor_at_anchor |
jrobichaud/django-structlog | c0c333b15e56ccc28ee459fb046ced74e4ff44a2 | 63 | train | train | django_structlog_demo_project/home/tests/test_api_views.py | test | assert | numeric_literal | 11 | import pytest
from .. import api_views
pytestmark = pytest.mark.django_db
class TestApiView:
def test(self, caplog, request_factory):
response = api_views.home_api_view(request_factory.get("/"))
assert response.status_code == | 200 | c0c333b15e56ccc28ee459fb046ced74e4ff44a2 | 63 | v2_extractor_at_anchor |
jrobichaud/django-structlog | c0c333b15e56ccc28ee459fb046ced74e4ff44a2 | 63 | train | train | django_structlog_demo_project/home/tests/test_api_views.py | test | assert | string_literal | 14 | import pytest
from .. import api_views
pytestmark = pytest.mark.django_db
class TestApiView:
def test(self, caplog, request_factory):
response = api_views.home_api_view(request_factory.get("/"))
assert response.status_code == 200
assert len(caplog.records) == 1
record = caplog.rec... | "This is a rest-framework structured log" | c0c333b15e56ccc28ee459fb046ced74e4ff44a2 | 63 | v2_extractor_at_anchor |
jrobichaud/django-structlog | c0c333b15e56ccc28ee459fb046ced74e4ff44a2 | 63 | train | train | django_structlog_demo_project/home/tests/test_views.py | test | assert | numeric_literal | 12 | import pytest
from .. import views
pytestmark = pytest.mark.django_db
pytest_plugins = ("pytest_asyncio",)
class TestEnqueueSuccessfulTask:
def test(self):
response = views.enqueue_successful_task(None)
assert response.status_code == | 201 | c0c333b15e56ccc28ee459fb046ced74e4ff44a2 | 63 | v2_extractor_at_anchor |
jrobichaud/django-structlog | c0c333b15e56ccc28ee459fb046ced74e4ff44a2 | 63 | train | train | django_structlog_demo_project/home/tests/test_views.py | test | assert | numeric_literal | 12 | import pytest
from .. import views
pytestmark = pytest.mark.django_db
pytest_plugins = ("pytest_asyncio",)
class TestLogWithStandardLogger:
def test(self):
response = views.log_with_standard_logger(None)
assert response.status_code == | 200 | c0c333b15e56ccc28ee459fb046ced74e4ff44a2 | 63 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.