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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
speaches-ai/speaches | 62cc77d10e463447eedb70beab6ea50680b58762 | 53 | train | train | tests/text_utils_test.py | test_strip_markdown_emphasis | assert | string_literal | 19 | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
def test_strip_markdown_emphasis() -> None:
assert strip_markdown_emphasis("Hello my name is **Jon**") == "Hello my name is Jon"
assert strip_m... | "No markdown here" | 62cc77d10e463447eedb70beab6ea50680b58762 | 53 | v2_extractor_at_anchor |
speaches-ai/speaches | 62cc77d10e463447eedb70beab6ea50680b58762 | 53 | train | train | tests/text_utils_test.py | test_strip_markdown_emphasis | assert | string_literal | 15 | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
def test_strip_markdown_emphasis() -> None:
assert strip_markdown_emphasis("Hello my name is **Jon**") == "Hello my name is Jon"
assert strip_... | "I really like this" | 62cc77d10e463447eedb70beab6ea50680b58762 | 53 | v2_extractor_at_anchor |
speaches-ai/speaches | 62cc77d10e463447eedb70beab6ea50680b58762 | 53 | train | train | tests/text_utils_test.py | test_strip_markdown_emphasis | assert | string_literal | 16 | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
def test_strip_markdown_emphasis() -> None:
assert strip_markdown_emphasis("Hello my name is **Jon**") == "Hello my name is Jon"
assert strip_m... | "This is underlined" | 62cc77d10e463447eedb70beab6ea50680b58762 | 53 | v2_extractor_at_anchor |
speaches-ai/speaches | 62cc77d10e463447eedb70beab6ea50680b58762 | 53 | train | train | tests/text_utils_test.py | test_strip_markdown_emphasis | assert | string_literal | 14 | import asyncio
import pytest
from speaches.text_utils import (
EOFTextChunker,
srt_format_timestamp,
strip_markdown_emphasis,
vtt_format_timestamp,
)
def test_strip_markdown_emphasis() -> None:
assert strip_markdown_emphasis("Hello my name is **Jon**") == | "Hello my name is Jon" | 62cc77d10e463447eedb70beab6ea50680b58762 | 53 | v2_extractor_at_anchor |
speaches-ai/speaches | 62cc77d10e463447eedb70beab6ea50680b58762 | 53 | train | train | tests/vad_test.py | test_speech_timestamps_basic | assert | numeric_literal | 24 | from pathlib import Path
import anyio
from httpx import AsyncClient
import pytest
from speaches.routers.vad import MODEL_ID, SpeechTimestamp
FILE_PATH = "audio.wav"
ENDPOINT = "/v1/audio/speech/timestamps"
@pytest.mark.asyncio
async def test_speech_timestamps_basic(aclient: AsyncClient) -> None:
extension = Pat... | 1 | 62cc77d10e463447eedb70beab6ea50680b58762 | 53 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/vm/test_vm.py | test_w_base | assert | complex_expr | 27 | import fixedint
import pytest
from spy.vm.primitive import W_I32, W_Bool, W_NoneType
from spy.vm.vm import SPyVM
from spy.vm.b import B
from spy.fqn import FQN
from spy.vm.object import W_Object, W_Type
from spy.vm.str import W_Str
from spy.vm.exc import W_Exception
from spy.vm.builtin import builtin_type
from spy.test... | W_A._w | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_00_bluemod.py | test_load_global | assert | complex_expr | 42 | from typing import Any
import textwrap
import pytest
from spy.vm.vm import SPyVM
from spy.vm.b import B
from spy.vm.function import W_FuncType, W_ASTFunc
from spy.backend.interp import InterpModuleWrapper
class TestBlueMod:
def init(self, tmpdir):
self.tmpdir = tmpdir
self.vm = SPyVM()
sel... | B.w_i32 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_opspec.py | test_new_OpArg | assert | complex_expr | 27 | from spy.vm.b import B
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.opimpl import W_OpImpl
from spy.tests.support import CompilerTest, only_interp, expect_errors
class TestOpSpec(CompilerTest):
def test_new_OpArg(self):
mod = self.compile(
"""
from operator import OpArg
... | B.w_i32 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_unsafe.py | test_itemtype | assert | complex_expr | 20 | from spy.errors import SPyError
from spy.vm.b import B
from spy.vm.modules.unsafe import UNSAFE
from spy.vm.modules.unsafe.ptr import W_Ptr
from spy.tests.wasm_wrapper import WasmPtr
from spy.tests.support import CompilerTest, expect_errors, only_interp
class TestUnsafe(CompilerTest):
@only_interp
def test_it... | B.w_i32 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/vm/test_builtin.py | test_return_None | assert | complex_expr | 24 | import pytest
from typing import Annotated
from spy.errors import SPyError
from spy.vm.object import W_Object
from spy.vm.primitive import W_I32, W_Dynamic
from spy.vm.vm import SPyVM
from spy.vm.w import W_FuncType, W_BuiltinFunc, W_Str
from spy.vm.b import B
from spy.fqn import FQN
from spy.vm.builtin import (builtin... | B.w_None | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/vm/test_builtin.py | test_builtin_method | assert | complex_expr | 30 | import pytest
from typing import Annotated
from spy.errors import SPyError
from spy.vm.object import W_Object
from spy.vm.primitive import W_I32, W_Dynamic
from spy.vm.vm import SPyVM
from spy.vm.w import W_FuncType, W_BuiltinFunc, W_Str
from spy.vm.b import B
from spy.fqn import FQN
from spy.vm.builtin import (builtin... | W_Foo._w | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/vm/test_function.py | test_FunctionType_eq | assert | complex_expr | 34 | from typing import no_type_check
from spy.fqn import FQN
from spy.vm.object import W_Type
from spy.vm.vm import SPyVM
from spy.vm.b import B
from spy.vm.w import W_FuncType
from spy.vm.function import W_ASTFunc, FuncParam, FuncKind, Color
def make_FuncType(
*types_w: W_Type,
w_restype: W_Type,
... | B.w_True | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/vm/test_function.py | test_function_eq | assert | complex_expr | 38 | from typing import no_type_check
from spy.fqn import FQN
from spy.vm.object import W_Type
from spy.vm.vm import SPyVM
from spy.vm.b import B
from spy.vm.w import W_FuncType
from spy.vm.function import W_ASTFunc, FuncParam, FuncKind, Color
def make_FuncType(
*types_w: W_Type,
w_restype: W_Type,
... | B.w_False | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_debug.py | test_debug_info | assert | complex_expr | 34 | import re
import pytest
from spy.tests.support import CompilerTest, only_C
class TestDebug(CompilerTest):
RE_SPY_LINE = re.compile(r"#line SPY_LINE\((\d+), (\d+)\)")
def test_debug_info(self):
mod = self.compile(
"""
def foo() -> i32: # line 2 <==
x: i32 = 3 # line... | lineno + 1 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/cffi_wrapper.py | isolated_import | assert | complex_expr | 12 | from typing import Any
import sys
import py.path
from spy.vm.vm import SPyVM
def isolated_import(modname: str, sofile: py.path.local):
"""
Import the given modules in isolation, without leaving trace in
sys.modules
"""
assert modname not in | sys.modules | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_opspec.py | test_call_OP_with_types | assert | complex_expr | 20 | from spy.vm.b import B
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.opimpl import W_OpImpl
from spy.tests.support import CompilerTest, only_interp, expect_errors
class TestOpSpec(CompilerTest):
def test_call_OP_with_types(self):
from spy.vm.modules.operator import OP
mod = self.compile(... | OP.w_i32_add | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_opspec.py | test_opspec_null | assert | complex_expr | 19 | from spy.vm.b import B
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.opimpl import W_OpImpl
from spy.tests.support import CompilerTest, only_interp, expect_errors
class TestOpSpec(CompilerTest):
def test_opspec_null(self):
mod = self.compile(
"""
from operator import OpSpec
... | W_OpSpec.NULL | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_opspec.py | test_OpSpec_new | assert | complex_expr | 29 | import pytest
from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C, expect_errors
class... | mod.bar.w_func | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_opspec.py | test_new_OpSpec | assert | complex_expr | 23 | from spy.vm.b import B
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.opimpl import W_OpImpl
from spy.tests.support import CompilerTest, only_interp, expect_errors
class TestOpSpec(CompilerTest):
def test_new_OpSpec(self):
mod = self.compile(
"""
from operator import OpSpec
... | mod.bar.w_func | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_attrop.py | test_descriptor_get_set | assert | numeric_literal | 82 | from typing import Annotated
import pytest
from spy.vm.primitive import W_I32
from spy.vm.b import B
from spy.vm.member import Member
from spy.vm.builtin import (builtin_func, builtin_method, builtin_class_attr,
builtin_property)
from spy.vm.w import W_Object, W_Str
from spy.vm.opspec import... | 0 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_binop.py | test_add | assert | numeric_literal | 28 | from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C
class TestOperatorBinop(CompilerTe... | 9 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_binop.py | test_sub | assert | numeric_literal | 28 | from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C
class TestOperatorBinop(CompilerTe... | 7 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_binop.py | test_div | assert | numeric_literal | 28 | from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C
class TestOperatorBinop(CompilerTe... | 5 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_binop.py | test_mod | assert | numeric_literal | 28 | from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C
class TestOperatorBinop(CompilerTe... | 1 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_binop.py | test_bitwise_ops | assert | numeric_literal | 36 | from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C
class TestOperatorBinop(CompilerTe... | 4 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_binop.py | test_eq_ne | assert | numeric_literal | 33 | from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C
class TestOperatorBinop(CompilerTe... | 0 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_itemop.py | test_2darray | assert | numeric_literal | 37 | from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C
class TestItemop(CompilerTest):
... | 0 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_unaryop.py | test_neg | assert | numeric_literal | 30 | from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C
class TestOperatorUnaryOp(Compiler... | 0 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_basic.py | test_binop | assert | numeric_literal | 17 | import pytest
from spy.fqn import FQN
from spy.errors import SPyError
from spy.vm.b import B
from spy.fqn import FQN
from spy.tests.support import (CompilerTest, skip_backends, expect_errors, only_interp, no_C)
class TestBasic(CompilerTest):
def test_binop(self):
mod = self.compile(
"""
de... | 3 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_basic.py | test_upcast_and_downcast | assert | numeric_literal | 20 | import pytest
from spy.fqn import FQN
from spy.errors import SPyError
from spy.vm.b import B
from spy.fqn import FQN
from spy.tests.support import (CompilerTest, skip_backends, expect_errors, only_interp, no_C)
class TestBasic(CompilerTest):
@skip_backends('C', reason='type <object> not supported')
def test_u... | 1 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_basic.py | test_explicit_BinOp | assert | numeric_literal | 19 | import pytest
from spy.fqn import FQN
from spy.errors import SPyError
from spy.vm.b import B
from spy.fqn import FQN
from spy.tests.support import (CompilerTest, skip_backends, expect_errors, only_interp, no_C)
class TestBasic(CompilerTest):
@pytest.mark.skip(reason="the result of op.ADD should be blue but it's r... | 8 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_basic.py | test_StmtExpr | assert | numeric_literal | 22 | import pytest
from spy.fqn import FQN
from spy.errors import SPyError
from spy.vm.b import B
from spy.fqn import FQN
from spy.tests.support import (CompilerTest, skip_backends, expect_errors, only_interp, no_C)
class TestBasic(CompilerTest):
def test_StmtExpr(self):
mod = self.compile("""
var x: i... | 2 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_basic.py | test_if_stmt | assert | numeric_literal | 41 | import pytest
from spy.fqn import FQN
from spy.errors import SPyError
from spy.vm.b import B
from spy.fqn import FQN
from spy.tests.support import (CompilerTest, skip_backends, expect_errors, only_interp, no_C)
class TestBasic(CompilerTest):
def test_if_stmt(self):
mod = self.compile("""
var a: i3... | 0 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_basic.py | test_max_min | assert | numeric_literal | 19 | import pytest
from spy.fqn import FQN
from spy.errors import SPyError
from spy.vm.b import B
from spy.fqn import FQN
from spy.tests.support import (CompilerTest, skip_backends, expect_errors, only_interp, no_C)
class TestBasic(CompilerTest):
def test_max_min(self):
mod = self.compile("""
def mymax... | 5 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_basic.py | test_redshift_nonglobal_function | assert | numeric_literal | 22 | import pytest
from spy.fqn import FQN
from spy.errors import SPyError
from spy.vm.b import B
from spy.fqn import FQN
from spy.tests.support import (CompilerTest, skip_backends, expect_errors, only_interp, no_C)
class TestBasic(CompilerTest):
def test_redshift_nonglobal_function(self):
mod = self.compile("... | 7 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_basic.py | test_call_blue_closure | assert | numeric_literal | 22 | import pytest
from spy.fqn import FQN
from spy.errors import SPyError
from spy.vm.b import B
from spy.fqn import FQN
from spy.tests.support import (CompilerTest, skip_backends, expect_errors, only_interp, no_C)
class TestBasic(CompilerTest):
def test_call_blue_closure(self):
mod = self.compile("""
... | 9 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_builtins.py | test_len | assert | numeric_literal | 30 | from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C, expect_errors
class TestBuiltins(... | 5 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_builtins.py | test_len | assert | numeric_literal | 32 | from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C, expect_errors
class TestBuiltins(... | 0 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_dynamic.py | test_upcast_and_downcast | assert | numeric_literal | 18 | import re
import pytest
from spy.errors import SPyError
from spy.tests.support import CompilerTest, skip_backends
class TestDynamic(CompilerTest):
def test_upcast_and_downcast(self):
# this is similar to the same test in test_basic, but it uses
# `dynamic` instead of `object`
mod = self.co... | 1 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_dynamic.py | test_dynamic_dispatch_ok | assert | numeric_literal | 16 | import re
import pytest
from spy.errors import SPyError
from spy.tests.support import CompilerTest, skip_backends
class TestDynamic(CompilerTest):
def test_dynamic_dispatch_ok(self):
mod = self.compile("""
def foo() -> i32:
x: dynamic = 1
y: dynamic = 2
return x... | 3 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_dynamic.py | test_call | assert | numeric_literal | 20 | import re
import pytest
from spy.errors import SPyError
from spy.tests.support import CompilerTest, skip_backends
class TestDynamic(CompilerTest):
def test_call(self):
mod = self.compile("""
def inc(x: i32) -> i32:
return x + 1
def get_inc() -> dynamic:
return inc
... | 8 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_exception.py | test_raise | assert | numeric_literal | 27 | import pytest
from spy.errors import SPyError
from spy.tests.support import CompilerTest, expect_errors, no_C
class TestException(CompilerTest):
def test_raise(self):
# for now, we don't support "except:", and raising an exception result
# in a panic.
mod = self.compile("""
def foo... | 6 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_importing.py | test_type_in_other_module | assert | numeric_literal | 32 | from spy.tests.support import CompilerTest, expect_errors, only_interp
class TestImporting(CompilerTest):
def test_type_in_other_module(self):
self.SKIP_SPY_BACKEND_SANITY_CHECK = True
self.write_file("point.spy", """
from unsafe import struct
@struct
class Point:
... | 7 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_int.py | test_float_to_int | assert | numeric_literal | 20 | import pytest
from spy.errors import SPyError
from spy.tests.support import (CompilerTest)
def int_type(request):
return request.param
class TestInt(CompilerTest):
def test_float_to_int(self):
mod = self.compile(
"""
def to_i32(x: f64) -> i32: return i32(x)
""")
MAX = ... | 0 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_int.py | test_binop | assert | numeric_literal | 21 | import pytest
from spy.errors import SPyError
from spy.tests.support import (CompilerTest)
def int_type(request):
return request.param
class TestInt(CompilerTest):
def test_binop(self, int_type):
mod = self.compile(f"""
T = {int_type}
def add(x: T, y: T) -> T: return x + y
... | 3 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_int.py | test_binop | assert | numeric_literal | 22 | import pytest
from spy.errors import SPyError
from spy.tests.support import (CompilerTest)
def int_type(request):
return request.param
class TestInt(CompilerTest):
def test_binop(self, int_type):
mod = self.compile(f"""
T = {int_type}
def add(x: T, y: T) -> T: return x + y
... | 4 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_int.py | test_binop | assert | numeric_literal | 24 | import pytest
from spy.errors import SPyError
from spy.tests.support import (CompilerTest)
def int_type(request):
return request.param
class TestInt(CompilerTest):
def test_binop(self, int_type):
mod = self.compile(f"""
T = {int_type}
def add(x: T, y: T) -> T: return x + y
... | 1 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_int.py | test_binop | assert | numeric_literal | 26 | import pytest
from spy.errors import SPyError
from spy.tests.support import (CompilerTest)
def int_type(request):
return request.param
class TestInt(CompilerTest):
def test_binop(self, int_type):
mod = self.compile(f"""
T = {int_type}
def add(x: T, y: T) -> T: return x + y
... | 5 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_math.py | test_sqrt | assert | numeric_literal | 15 | import math
from spy.tests.support import CompilerTest
class TestMath(CompilerTest):
def test_sqrt(self):
mod = self.compile(
"""
from math import sqrt
def foo(x: f64) -> f64:
return sqrt(x)
""")
assert mod.foo(64.0) == | 8 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_opspec.py | test_OpSpec_with_args | assert | numeric_literal | 27 | from spy.vm.b import B
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.opimpl import W_OpImpl
from spy.tests.support import CompilerTest, only_interp, expect_errors
class TestOpSpec(CompilerTest):
def test_OpSpec_with_args(self):
mod = self.compile(
"""
from operator import OpSpec,... | 1 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_py_cffi.py | test_simple | assert | numeric_literal | 15 | from spy.tests.support import CompilerTest, only_py_cffi
class TestPyCFFI(CompilerTest):
def test_simple(self):
mod = self.compile(
"""
def add(x: i32, y: i32) -> i32:
return x + y
""")
assert mod.__name__ == 'test' # this is 'pyfile'
assert hasattr(mod.... | 9 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_str.py | test_len | assert | numeric_literal | 13 | from spy.errors import SPyError
from spy.tests.support import CompilerTest
class TestStr(CompilerTest):
def test_len(self):
src = """
def foo(s: str) -> i32:
return len(s)
"""
mod = self.compile(src)
assert mod.foo("") == | 0 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_str.py | test_len | assert | numeric_literal | 14 | from spy.errors import SPyError
from spy.tests.support import CompilerTest
class TestStr(CompilerTest):
def test_len(self):
src = """
def foo(s: str) -> i32:
return len(s)
"""
mod = self.compile(src)
assert mod.foo("") == 0
assert mod.foo("abc") == | 3 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_tuple.py | test_getitem | assert | numeric_literal | 15 | from spy.errors import SPyError
from spy.tests.support import CompilerTest, only_interp, expect_errors
class TestTuple(CompilerTest):
def test_getitem(self):
mod = self.compile(
"""
def foo(i: i32) -> dynamic:
tup = 1, 2, 'hello'
return tup[i]
""")
x... | 1 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_tuple.py | test_unpacking | assert | numeric_literal | 18 | from spy.errors import SPyError
from spy.tests.support import CompilerTest, only_interp, expect_errors
class TestTuple(CompilerTest):
def test_unpacking(self):
mod = self.compile(
"""
def make_tuple() -> tuple:
return 1, 2, 'hello'
def foo() -> i32:
a, b, c... | 3 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_unsafe.py | test_can_allocate_ptr | assert | numeric_literal | 29 | from spy.errors import SPyError
from spy.vm.b import B
from spy.vm.modules.unsafe import UNSAFE
from spy.vm.modules.unsafe.ptr import W_Ptr
from spy.tests.wasm_wrapper import WasmPtr
from spy.tests.support import CompilerTest, expect_errors, only_interp
class TestUnsafe(CompilerTest):
def test_can_allocate_ptr(se... | 3 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_unsafe.py | test_ptr_NULL | assert | numeric_literal | 21 | from spy.errors import SPyError
from spy.vm.b import B
from spy.vm.modules.unsafe import UNSAFE
from spy.vm.modules.unsafe.ptr import W_Ptr
from spy.tests.wasm_wrapper import WasmPtr
from spy.tests.support import CompilerTest, expect_errors, only_interp
class TestUnsafe(CompilerTest):
def test_ptr_NULL(self):
... | 0 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/test_cli.py | test_py_file_error | assert | numeric_literal | 79 | from typing import Any
import re
import textwrap
import subprocess
from subprocess import getstatusoutput
import pytest
from typer.testing import CliRunner
import spy
from spy.cli import app
PYODIDE_EXE = spy.ROOT.dirpath().join('pyodide', 'venv', 'bin', 'python')
ANSI_ESCAPE = re.compile(r'''
\x1B # ESC
(?:... | 1 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/test_fqn.py | test_FQN_suffix | assert | numeric_literal | 7 | from spy.fqn import NSPart, FQN
def test_FQN_suffix():
a = FQN("aaa::bbb#1")
assert a.fullname == "aaa::bbb#1"
assert a.parts[-1].suffix == | 1 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/test_fqn_parser.py | test_single_unqualified_part | assert | numeric_literal | 6 | from spy.fqn_parser import FQN, tokenize
def test_single_unqualified_part():
fqn = FQN("foo")
assert len(fqn.parts) == | 1 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/test_fqn_parser.py | test_single_unqualified_part | assert | numeric_literal | 9 | from spy.fqn_parser import FQN, tokenize
def test_single_unqualified_part():
fqn = FQN("foo")
assert len(fqn.parts) == 1
assert fqn.parts[0].name == "foo"
assert fqn.parts[0].qualifiers == []
assert fqn.parts[0].suffix == | 0 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/test_fqn_parser.py | test_two_parts | assert | numeric_literal | 6 | from spy.fqn_parser import FQN, tokenize
def test_two_parts():
fqn = FQN("mod::foo")
assert len(fqn.parts) == | 2 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/test_magic_py_parse.py | test_preprocess_var | assert | numeric_literal | 17 | import textwrap
from spy.magic_py_parse import magic_py_parse, preprocess
from spy.ast_dump import dump
def test_preprocess_var():
src1 = textwrap.dedent("""
var x: i32 = 100
var y : i32 = 200
""")
src2, var_locs = preprocess(src1)
expected = textwrap.dedent("""
x : i32 = 100
... | 2 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/test_textbuilder.py | test_lineno | assert | numeric_literal | 10 | import pytest
import textwrap
from spy.textbuilder import TextBuilder, ColorFormatter
class TestTextBuilder:
def test_lineno(self):
b = TextBuilder()
assert b.lineno == | 1 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/test_textbuilder.py | test_lineno | assert | numeric_literal | 12 | import pytest
import textwrap
from spy.textbuilder import TextBuilder, ColorFormatter
class TestTextBuilder:
def test_lineno(self):
b = TextBuilder()
assert b.lineno == 1
b.wl('one')
assert b.lineno == | 2 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/test_textbuilder.py | test_lineno | assert | numeric_literal | 18 | import pytest
import textwrap
from spy.textbuilder import TextBuilder, ColorFormatter
class TestTextBuilder:
def test_lineno(self):
b = TextBuilder()
assert b.lineno == 1
b.wl('one')
assert b.lineno == 2
b.wb("""
two
three
four
""")
... | 5 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/test_util.py | test_ANYTHING | assert | numeric_literal | 7 | from typing import Any
import pytest
from spy.util import ANYTHING, magic_dispatch, extend, shortrepr
def test_ANYTHING():
assert ANYTHING == | 1 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/test_util.py | test_magic_dispatch | assert | numeric_literal | 18 | from typing import Any
import pytest
from spy.util import ANYTHING, magic_dispatch, extend, shortrepr
def test_magic_dispatch():
class Foo:
def visit(self, obj: Any, arg: int) -> Any:
return magic_dispatch(self, 'visit', obj, arg)
def visit_int(self, x: int, y: int) -> int:
... | 9 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_attrop.py | test_class_attribute | assert | numeric_literal | 43 | from typing import Annotated
import pytest
from spy.vm.primitive import W_I32
from spy.vm.b import B
from spy.vm.member import Member
from spy.vm.builtin import (builtin_func, builtin_method, builtin_class_attr,
builtin_property)
from spy.vm.w import W_Object, W_Str
from spy.vm.opspec import... | 42 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_attrop.py | test_descriptor_get_set | assert | numeric_literal | 80 | from typing import Annotated
import pytest
from spy.vm.primitive import W_I32
from spy.vm.b import B
from spy.vm.member import Member
from spy.vm.builtin import (builtin_func, builtin_method, builtin_class_attr,
builtin_property)
from spy.vm.w import W_Object, W_Str
from spy.vm.opspec import... | 10 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_attrop.py | test_instance_property | assert | numeric_literal | 73 | from typing import Annotated
import pytest
from spy.vm.primitive import W_I32
from spy.vm.b import B
from spy.vm.member import Member
from spy.vm.builtin import (builtin_func, builtin_method, builtin_class_attr,
builtin_property)
from spy.vm.w import W_Object, W_Str
from spy.vm.opspec import... | 86 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_callop.py | test_w_new_simple | assert | numeric_literal | 43 | from typing import Annotated
from spy.vm.primitive import W_I32
from spy.vm.member import Member
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Type, W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests... | 36 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_callop.py | test_w_new_metafunc | assert | numeric_literal | 69 | from typing import Annotated
from spy.vm.primitive import W_I32
from spy.vm.member import Member
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Type, W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests... | 77 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_callop.py | test_call_varargs | assert | numeric_literal | 33 | from typing import Annotated
from spy.vm.primitive import W_I32
from spy.vm.member import Member
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Type, W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests... | 16 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_callop.py | test_call_instance | assert | numeric_literal | 47 | from typing import Annotated
from spy.vm.primitive import W_I32
from spy.vm.member import Member
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Type, W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests... | 12 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_callop.py | test_call_method | assert | numeric_literal | 64 | from typing import Annotated
from spy.vm.primitive import W_I32
from spy.vm.member import Member
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Type, W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests... | 63 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_convop.py | test_convert_to | assert | numeric_literal | 35 | from typing import Annotated
from spy.vm.primitive import W_I32
from spy.vm.b import B
from spy.vm.member import Member
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Type, W_Object, W_Str
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.... | 42 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_itemop.py | test_getitem | assert | numeric_literal | 29 | from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C
class TestItemop(CompilerTest):
... | 15 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_itemop.py | test_getitem | assert | numeric_literal | 30 | from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C
class TestItemop(CompilerTest):
... | 27 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_itemop.py | test_setitem | assert | numeric_literal | 30 | from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C
class TestItemop(CompilerTest):
... | 42 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_itemop.py | test_2darray | assert | numeric_literal | 35 | from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C
class TestItemop(CompilerTest):
... | 24 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_itemop.py | test_2darray | assert | numeric_literal | 36 | from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C
class TestItemop(CompilerTest):
... | 99 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_opspec.py | test_complex_OpSpec | assert | numeric_literal | 55 | import pytest
from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C, expect_errors
class... | 30 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_opspec.py | test_opspec_const | assert | numeric_literal | 42 | import pytest
from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C, expect_errors
class... | 42 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_unaryop.py | test_neg | assert | numeric_literal | 28 | from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C
class TestOperatorUnaryOp(Compiler... | -5 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/operator/test_unaryop.py | test_neg | assert | numeric_literal | 29 | from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C
class TestOperatorUnaryOp(Compiler... | 10 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_00_bluemod.py | test_simple | assert | numeric_literal | 39 | from typing import Any
import textwrap
import pytest
from spy.vm.vm import SPyVM
from spy.vm.b import B
from spy.vm.function import W_FuncType, W_ASTFunc
from spy.backend.interp import InterpModuleWrapper
class TestBlueMod:
def init(self, tmpdir):
self.tmpdir = tmpdir
self.vm = SPyVM()
sel... | 42 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_00_bluemod.py | test_param | assert | numeric_literal | 39 | from typing import Any
import textwrap
import pytest
from spy.vm.vm import SPyVM
from spy.vm.b import B
from spy.vm.function import W_FuncType, W_ASTFunc
from spy.backend.interp import InterpModuleWrapper
class TestBlueMod:
def init(self, tmpdir):
self.tmpdir = tmpdir
self.vm = SPyVM()
sel... | 53 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_builtins.py | test_len | assert | numeric_literal | 31 | from spy.vm.primitive import W_I32
from spy.vm.builtin import builtin_func, builtin_method
from spy.vm.w import W_Object
from spy.vm.opspec import W_OpSpec, W_OpArg
from spy.vm.registry import ModuleRegistry
from spy.vm.vm import SPyVM
from spy.tests.support import CompilerTest, no_C, expect_errors
class TestBuiltins(... | 42 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_dynamic.py | test_other_ops | assert | numeric_literal | 19 | import re
import pytest
from spy.errors import SPyError
from spy.tests.support import CompilerTest, skip_backends
class TestDynamic(CompilerTest):
def test_other_ops(self):
mod = self.compile("""
def mul(x: dynamic, y: dynamic) -> dynamic: return x * y
def eq (x: dynamic, y: dynamic) -> d... | 30 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_dynamic.py | test_setattr | assert | numeric_literal | 19 | import re
import pytest
from spy.errors import SPyError
from spy.tests.support import CompilerTest, skip_backends
class TestDynamic(CompilerTest):
def test_setattr(self):
mod = self.compile(
"""
x: i32 = 0
@blue
def __INIT__(mod: dynamic):
mod.x = 42
""... | 42 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_dynamic.py | test_getattr | assert | numeric_literal | 21 | import re
import pytest
from spy.errors import SPyError
from spy.tests.support import CompilerTest, skip_backends
class TestDynamic(CompilerTest):
def test_getattr(self):
mod = self.compile(
"""
x: i32 = 42
y: i32 = 0
@blue
def __INIT__(mod: dynamic):
m... | 43 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_exception.py | test_raise | assert | numeric_literal | 22 | import pytest
from spy.errors import SPyError
from spy.tests.support import CompilerTest, expect_errors, no_C
class TestException(CompilerTest):
def test_raise(self):
# for now, we don't support "except:", and raising an exception result
# in a panic.
mod = self.compile("""
def foo... | 42 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_importing.py | test_import | assert | numeric_literal | 14 | from spy.tests.support import CompilerTest, expect_errors, only_interp
class TestImporting(CompilerTest):
def test_import(self):
mod = self.compile("""
from builtins import abs as my_abs
def foo(x: i32) -> i32:
return my_abs(x)
""")
#
assert mod.foo(-2... | 20 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_importing.py | test_function_in_other_module | assert | numeric_literal | 19 | from spy.tests.support import CompilerTest, expect_errors, only_interp
class TestImporting(CompilerTest):
def test_function_in_other_module(self):
self.SKIP_SPY_BACKEND_SANITY_CHECK = True
self.write_file("delta.spy", """
def get_delta() -> i32:
return 10
""")
... | 14 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_int.py | test_i8_conversion | assert | numeric_literal | 20 | import pytest
from spy.errors import SPyError
from spy.tests.support import (CompilerTest)
def int_type(request):
return request.param
class TestInt(CompilerTest):
def test_i8_conversion(self):
mod = self.compile(
"""
def foo(x: i32) -> i8:
return x
def bar(x: i8)... | 42 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/compiler/test_int.py | test_i8_conversion | assert | numeric_literal | 23 | import pytest
from spy.errors import SPyError
from spy.tests.support import (CompilerTest)
def int_type(request):
return request.param
class TestInt(CompilerTest):
def test_i8_conversion(self):
mod = self.compile(
"""
def foo(x: i32) -> i8:
return x
def bar(x: i8)... | -1 | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/test_fqn.py | test_FQN_hash_eq | assert | variable | 7 | from spy.fqn import NSPart, FQN
def test_FQN_hash_eq():
a = FQN("aaa::bbb")
b = FQN("aaa::bbb")
assert a == | b | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/test_textbuilder.py | test_color_contextmanager | assert | variable | 51 | import pytest
import textwrap
from spy.textbuilder import TextBuilder, ColorFormatter
class TestColorFormatter:
def test_color_contextmanager(self):
b = TextBuilder(use_colors=True)
# Basic color context
with b.color('red'):
b.write('red text')
b.writeline()
#... | s | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
spylang/spy | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | train | train | spy/tests/vm/test_opimpl.py | test_shuffle_args | assert | variable | 30 | import textwrap
from spy.location import Loc
from spy.vm.vm import SPyVM
from spy.vm.object import W_Object
from spy.vm.function import W_FuncType
from spy.vm.opimpl import W_OpImpl, ArgSpec
from spy.vm.primitive import W_I32
from spy.vm.str import W_Str
from spy.vm.builtin import builtin_func
from spy.vm.b import OP
... | r | 9beb625b75d97536a0298a959fcda508f986abb5 | 371 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.