repo_id
stringclasses
409 values
prefix
large_stringlengths
34
36.3k
target
large_stringlengths
1
498
assertion_type
stringclasses
31 values
difficulty
stringclasses
8 values
test_file
stringlengths
10
121
test_function
stringlengths
1
104
test_class
stringlengths
0
51
lineno
int32
2
11.3k
commit_idx
int32
drvinceknight/Nashpy
import unittest import warnings import numpy as np from nashpy.algorithms.lemke_howson import lemke_howson class TestLemkeHowson(unittest.TestCase): def test_lemke_howson_lex_degenerate_tie_breaking_looping( self, ): A = np.array( [ [0.0, 0.5, 1.0, 1.0, 1.0, 1.0, ...
14)
self.assertGreaterEqual
numeric_literal
tests/unit/test_lemke_howson.py
test_lemke_howson_lex_degenerate_tie_breaking_looping
TestLemkeHowson
131
null
drvinceknight/Nashpy
import numpy as np import pytest from hypothesis import given from hypothesis.strategies import integers from hypothesis.extra.numpy import arrays from nashpy.egt.moran_process import ( fixation_probabilities, get_complete_graph_adjacency_matrix, is_population_not_fixed, moran_process, score_all_i...
expected_probabilities
assert
variable
tests/unit/test_moran_process.py
test_fixation_probablities_0
560
null
drvinceknight/Nashpy
import unittest import numpy as np from hypothesis import given from hypothesis.extra.numpy import arrays from nashpy.linalg import Tableau, TableauLex, create_row_tableau, create_col_tableau class TestTableau(unittest.TestCase): def test_creation_of_particular_row_tableau(self): M = np.array([[3, 2, -1...
set([2, 3, 4]))
self.assertEqual
func_call
tests/unit/test_tableau.py
test_creation_of_particular_row_tableau
TestTableau
47
null
drvinceknight/Nashpy
import unittest import numpy as np from nashpy.algorithms.support_enumeration import ( indifference_strategies, is_ne, obey_support, potential_support_pairs, powerset, solve_indifference, ) class TestSupportEnumeration(unittest.TestCase): def test_obey_support_with_high_tolerance(self): ...
obey_support(np.array([1, 0]), np.array([0]), tol=tol))
self.assertFalse
func_call
tests/unit/test_support_enumeration.py
test_obey_support_with_high_tolerance
TestSupportEnumeration
244
null
drvinceknight/Nashpy
import unittest import numpy as np from nashpy.algorithms.support_enumeration import ( indifference_strategies, is_ne, obey_support, potential_support_pairs, powerset, solve_indifference, ) class TestSupportEnumeration(unittest.TestCase): def test_obey_support(self): """Test for ...
obey_support(False, np.array([0, 1])))
self.assertFalse
func_call
tests/unit/test_support_enumeration.py
test_obey_support
TestSupportEnumeration
229
null
drvinceknight/Nashpy
import numpy as np from nashpy.learning.discrete_replicator_dynamics import ( discrete_replicator_dynamics, type_1_discrete_step, type_2_discrete_step, greenwood_quantize, ) from hypothesis import given from hypothesis.extra.numpy import arrays from hypothesis.strategies import floats @given( k=ar...
N
assert
variable
tests/unit/test_discrete_replicator_dynamics.py
test_greenwood_quantize_sum_consistent
120
null
drvinceknight/Nashpy
from hypothesis import given from hypothesis.extra.numpy import arrays import numpy as np import pytest from nashpy.learning.stochastic_fictitious_play import ( get_distribution_response_to_play_count, stochastic_fictitious_play, ) def test_stochastic_fictitious_play_2x3(): np.random.seed(0) iteration...
iterations + 1
assert
complex_expr
tests/unit/test_stochastic_fictitious_play.py
test_stochastic_fictitious_play_2x3
137
null
drvinceknight/Nashpy
import numpy as np from nashpy.linalg.minimax import ( get_A_eq, get_A_ub, get_b_ub, get_bounds, get_c, linear_program, ) def test_get_c(): for number_of_rows in range(2, 10): c = get_c(number_of_rows=number_of_rows) assert c.shape == (number_of_rows + 1,) assert np...
-1
assert
numeric_literal
tests/unit/test_minimax.py
test_get_c
22
null
drvinceknight/Nashpy
import numpy as np import pytest from hypothesis import given from hypothesis.strategies import integers from hypothesis.extra.numpy import arrays from nashpy.egt.moran_process import ( fixation_probabilities, get_complete_graph_adjacency_matrix, is_population_not_fixed, moran_process, score_all_i...
False
assert
bool_literal
tests/unit/test_moran_process.py
test_is_population_not_fixed_for_fixed_population
279
null
drvinceknight/Nashpy
import numpy as np import nashpy as nash import nashpy.repeated_games def test_obtain_strategy_space_after_1_repetition_for_2_by_2_game(): A = np.array([[1, 2, 3], [4, 5, 6]]) expected_strategy_space = [{((), ()): (1.0, 0.0)}, {((), ()): (0.0, 1.0)}] strategy_space = list( nashpy.repeated_games.ob...
strategy_space
assert
variable
tests/unit/test_repeated_games.py
test_obtain_strategy_space_after_1_repetition_for_2_by_2_game
67
null
drvinceknight/Nashpy
import unittest from types import GeneratorType import numpy as np from hypothesis import given from hypothesis.extra.numpy import arrays from hypothesis.strategies import integers from nashpy.polytope.polytope import ( build_halfspaces, find_feasible_point, labels, non_trivial_vertices, ) class Test...
number_of_strategies + dimension)
self.assertLessEqual
complex_expr
tests/unit/test_polytope.py
test_creation_of_non_trivial_vertices
TestPolytope
128
null
drvinceknight/Nashpy
import numpy as np import pytest from hypothesis import given, settings from hypothesis.strategies import integers from hypothesis.extra.numpy import arrays from nashpy.learning.replicator_dynamics import ( get_derivative_of_fitness, replicator_dynamics, get_derivative_of_asymmetric_fitness, asymmetric...
len(x)
assert
func_call
tests/unit/test_replicator_dynamics.py
test_property_get_derivative_of_fitness
25
null
drvinceknight/Nashpy
import unittest import numpy as np from hypothesis import given from hypothesis.extra.numpy import arrays from nashpy.linalg import Tableau, TableauLex, create_row_tableau, create_col_tableau class TestTableau(unittest.TestCase): def test_particular_pivot(self): tableau = np.array( [ ...
0)
self.assertEqual
numeric_literal
tests/unit/test_tableau.py
test_particular_pivot
TestTableau
126
null
drvinceknight/Nashpy
import unittest import numpy as np from nashpy.algorithms.support_enumeration import ( indifference_strategies, is_ne, obey_support, potential_support_pairs, powerset, solve_indifference, ) class TestSupportEnumeration(unittest.TestCase): def test_is_ne(self): """Test if is ne"""...
is_ne(strategy_pair, support_pair, (A, -A)))
self.assertTrue
func_call
tests/unit/test_support_enumeration.py
test_is_ne
TestSupportEnumeration
273
null
drvinceknight/Nashpy
import unittest import warnings import numpy as np from hypothesis import given, settings from hypothesis.extra.numpy import arrays from hypothesis.strategies import integers import pytest import nashpy as nash import nashpy.learning class TestGame(unittest.TestCase): def test_degenerate_lemke_howson_provides_s...
0)
self.assertAlmostEqual
numeric_literal
tests/unit/test_game.py
test_degenerate_lemke_howson_provides_some_solution
TestGame
379
null
drvinceknight/Nashpy
import numpy as np import nashpy as nash import nashpy.repeated_games def test_obtain_states_after_1_repetition_for_2_by_2_game(): A = np.array([[1, 2], [3, 4]]) expected_states_after_1_repetition = [((), ())] states = list(nashpy.repeated_games.obtain_states(A=A, repetitions=1)) assert expected_stat...
states
assert
variable
tests/unit/test_repeated_games.py
test_obtain_states_after_1_repetition_for_2_by_2_game
15
null
drvinceknight/Nashpy
import unittest import numpy as np from nashpy.algorithms.support_enumeration import ( indifference_strategies, is_ne, obey_support, potential_support_pairs, powerset, solve_indifference, ) class TestSupportEnumeration(unittest.TestCase): def test_obey_support(self): """Test for ...
obey_support(np.array([0, 0.5]), np.array([0])))
self.assertFalse
func_call
tests/unit/test_support_enumeration.py
test_obey_support
TestSupportEnumeration
231
null
drvinceknight/Nashpy
import numpy as np import pytest from hypothesis import given from hypothesis.strategies import integers from hypothesis.extra.numpy import arrays from nashpy.egt.moran_process import ( fixation_probabilities, get_complete_graph_adjacency_matrix, is_population_not_fixed, moran_process, score_all_i...
np.sum(M)
assert
func_call
tests/unit/test_moran_process.py
test_properties_of_scores_for_arbitrary_adjacency_matrix
109
null
drvinceknight/Nashpy
import numpy as np import pytest from hypothesis import given, settings from hypothesis.strategies import integers from hypothesis.extra.numpy import arrays from nashpy.learning.replicator_dynamics import ( get_derivative_of_fitness, replicator_dynamics, get_derivative_of_asymmetric_fitness, asymmetric...
1000
assert
numeric_literal
tests/unit/test_replicator_dynamics.py
test_replicator_dynamics_game_size_3_example_default_timepoints
555
null
drvinceknight/Nashpy
import numpy as np from nashpy.linalg.minimax import ( get_A_eq, get_A_ub, get_b_ub, get_bounds, get_c, linear_program, ) def test_get_c(): for number_of_rows in range(2, 10): c = get_c(number_of_rows=number_of_rows) assert c.shape ==
(number_of_rows + 1,)
assert
collection
tests/unit/test_minimax.py
test_get_c
20
null
drvinceknight/Nashpy
import unittest import warnings import numpy as np from nashpy.algorithms.lemke_howson import lemke_howson class TestLemkeHowson(unittest.TestCase): def test_degenerate_lemke_howson_non_lex_raises_warning(self): """ This is a degenerate game so the algorithm fails. This was raised in ...
0)
self.assertGreater
numeric_literal
tests/unit/test_lemke_howson.py
test_degenerate_lemke_howson_non_lex_raises_warning
TestLemkeHowson
47
null
drvinceknight/Nashpy
from hypothesis import given from hypothesis.extra.numpy import arrays import numpy as np import pytest from nashpy.learning.stochastic_fictitious_play import ( get_distribution_response_to_play_count, stochastic_fictitious_play, ) def test_stochastic_fictitious_play_default_inputs(): np.random.seed(0) ...
2 * iterations
assert
complex_expr
tests/unit/test_stochastic_fictitious_play.py
test_stochastic_fictitious_play_default_inputs
115
null
drvinceknight/Nashpy
import types import numpy as np from hypothesis import given from hypothesis.extra.numpy import arrays from hypothesis.strategies import integers from nashpy.learning.fictitious_play import ( fictitious_play, get_best_response_to_play_count, update_play_count, ) @given(play=integers(min_value=0, max_valu...
updated_play_count[play]
assert
complex_expr
tests/unit/test_fictitious_play.py
test_property_update_belief
44
null
drvinceknight/Nashpy
import numpy as np import pytest from hypothesis import given from hypothesis.strategies import integers from hypothesis.extra.numpy import arrays from nashpy.egt.moran_process import ( fixation_probabilities, get_complete_graph_adjacency_matrix, is_population_not_fixed, moran_process, score_all_i...
True
assert
bool_literal
tests/unit/test_moran_process.py
test_is_population_not_fixed_for_not_fixed_population
290
null
drvinceknight/Nashpy
import unittest import numpy as np from hypothesis import given from hypothesis.extra.numpy import arrays from nashpy.linalg import Tableau, TableauLex, create_row_tableau, create_col_tableau class TestTableau(unittest.TestCase): def test_degenerate_pivot(self): tableau = TableauLex( np.arra...
3)
self.assertEqual
numeric_literal
tests/unit/test_tableau.py
test_degenerate_pivot
TestTableau
288
null
drvinceknight/Nashpy
import types import numpy as np from hypothesis import given from hypothesis.extra.numpy import arrays from hypothesis.strategies import integers from nashpy.learning.fictitious_play import ( fictitious_play, get_best_response_to_play_count, update_play_count, ) @given( A=arrays(np.int8, (4, 5)), ...
iterations + 1
assert
complex_expr
tests/unit/test_fictitious_play.py
test_property_fictitious_play
58
null
drvinceknight/Nashpy
import unittest import numpy as np from hypothesis import given from hypothesis.extra.numpy import arrays from nashpy.linalg import Tableau, TableauLex, create_row_tableau, create_col_tableau class TestTableau(unittest.TestCase): def test_creation_of_particular_row_tableau(self): M = np.array([[3, 2, -1...
set([0, 1]))
self.assertEqual
func_call
tests/unit/test_tableau.py
test_creation_of_particular_row_tableau
TestTableau
44
null
drvinceknight/Nashpy
import unittest import numpy as np from nashpy.algorithms.support_enumeration import ( indifference_strategies, is_ne, obey_support, potential_support_pairs, powerset, solve_indifference, ) class TestSupportEnumeration(unittest.TestCase): def test_obey_support(self): """Test for ...
obey_support(np.array([1, 0]), np.array([0])))
self.assertTrue
func_call
tests/unit/test_support_enumeration.py
test_obey_support
TestSupportEnumeration
234
null
drvinceknight/Nashpy
import unittest import warnings import numpy as np from hypothesis import given, settings from hypothesis.extra.numpy import arrays from hypothesis.strategies import integers import pytest import nashpy as nash import nashpy.learning class TestGame(unittest.TestCase): def test_incorrect_dimensions_init(self): ...
ValueError)
pytest.raises
variable
tests/unit/test_game.py
test_incorrect_dimensions_init
TestGame
56
null
drvinceknight/Nashpy
import unittest import warnings import numpy as np from hypothesis import given, settings from hypothesis.extra.numpy import arrays from hypothesis.strategies import integers import pytest import nashpy as nash import nashpy.learning class TestGame(unittest.TestCase): @given(A=arrays(np.int8, (4, 5)), B=arrays(...
g.zero_sum)
self.assertTrue
complex_expr
tests/unit/test_game.py
test_bi_matrix_init
TestGame
40
null
drvinceknight/Nashpy
from hypothesis import given from hypothesis.extra.numpy import arrays import numpy as np import pytest from nashpy.learning.stochastic_fictitious_play import ( get_distribution_response_to_play_count, stochastic_fictitious_play, ) @given(M=arrays(np.int8, (2, 2))) def test_property_get_distribution_response_...
len(play_count)
assert
func_call
tests/unit/test_stochastic_fictitious_play.py
test_property_get_distribution_response_to_play_count
24
null
buiapp/reaktiv
import pytest import asyncio from reaktiv import Signal, Effect, ComputeSignal, batch, untracked from reaktiv._debug import set_debug set_debug(True) @pytest.mark.asyncio async def test_compute_signal_dependencies(): a = Signal(2) b = Signal(3) sum_signal = ComputeSignal(lambda: a.get() + b.get()) ass...
7
assert
numeric_literal
tests/test_signals.py
test_compute_signal_dependencies
203
null
buiapp/reaktiv
import pytest from reaktiv import Signal, Computed, Effect def test_circular_dependency_with_effect(): """Test that effects can depend on signals with circular dependencies without issues.""" # Create a valid signal source = Signal(5) valid_computed = Computed(lambda: source() * 2) # Create circul...
1
assert
numeric_literal
tests/test_circular_dependency.py
test_circular_dependency_with_effect
124
null
buiapp/reaktiv
import asyncio import pytest import pytest_asyncio from reaktiv import ( Signal, Resource, ResourceStatus, Computed, ) _resources = [] async def cleanup_resources(): """Automatically clean up resources after each test.""" _resources.clear() yield # Cancel all pending tasks from resourc...
2
assert
numeric_literal
tests/test_resource.py
test_resource_params_change
99
null
buiapp/reaktiv
import gc import weakref from reaktiv import Signal, Effect def test_cleanup_on_rerun_then_gc(): """Cleanup should run on rerun, then again on GC.""" cleanup_ran = [] signal = Signal(0) def effect_fn(): value = signal() def cleanup(): cleanup_ran.append(f"cleanup for va...
2
assert
numeric_literal
tests/test_effect_del_cleanup.py
test_cleanup_on_rerun_then_gc
123
null
buiapp/reaktiv
from reaktiv import Signal, Linked, Effect def test_linked_decorator_manual_override() -> None: """Test that manual values persist until source changes.""" source = Signal(0) @Linked def counter() -> int: return source() assert counter() == 0 # Manually increment counter.set(5) ...
1
assert
numeric_literal
tests/test_linked_decorator.py
test_linked_decorator_manual_override
118
null
buiapp/reaktiv
from reaktiv import Signal, Linked, Effect def test_linked_decorator_basic() -> None: """Test basic @Linked decorator usage.""" source = Signal(5) @Linked def derived() -> int: return source() * 2 assert derived() == 10 # Can be read like computed source.set(10) assert deriv...
20
assert
numeric_literal
tests/test_linked_decorator.py
test_linked_decorator_basic
18
null
buiapp/reaktiv
import pytest import asyncio from unittest.mock import Mock from reaktiv import Signal, ComputeSignal, Effect, batch class TestBatchPerformance: @pytest.mark.asyncio async def test_no_unnecessary_effect_retriggers_in_batch(self): """Test that effects don't retrigger unnecessarily during batch processi...
0
assert
numeric_literal
tests/test_batch_performance.py
test_no_unnecessary_effect_retriggers_in_batch
TestBatchPerformance
134
null
buiapp/reaktiv
import pytest import asyncio from reaktiv import Signal, Effect, ComputeSignal, batch, untracked from reaktiv._debug import set_debug set_debug(True) @pytest.mark.asyncio async def test_diamond_dependency(): """Test computed signals with diamond-shaped dependencies""" base = Signal(1) a = ComputeSignal(la...
4
assert
numeric_literal
tests/test_signals.py
test_diamond_dependency
277
null
buiapp/reaktiv
import pytest import asyncio from reaktiv import Signal, Effect, ComputeSignal, batch, untracked from reaktiv.linked import LinkedSignal from reaktiv._debug import set_debug set_debug(True) def test_linked_signal_manual_operations(): """Test manual set and update operations""" source = Signal(5) linked = ...
6
assert
numeric_literal
tests/test_linked_signal.py
test_linked_signal_manual_operations
154
null
buiapp/reaktiv
import pytest import asyncio from reaktiv import Signal, Effect, ComputeSignal, batch, untracked from reaktiv._debug import set_debug set_debug(True) @pytest.mark.asyncio async def test_effect_dependency_tracking(): signal1 = Signal(0) signal2 = Signal("test") execution_count = 0 async def test_effec...
1
assert
numeric_literal
tests/test_signals.py
test_effect_dependency_tracking
59
null
buiapp/reaktiv
import pytest import asyncio from reaktiv import Signal, Effect, ComputeSignal, batch, untracked from reaktiv.linked import LinkedSignal from reaktiv._debug import set_debug set_debug(True) def test_linked_signal_previous_state(): """Test that previous state is correctly passed to computation function""" sour...
2
assert
numeric_literal
tests/test_linked_signal.py
test_linked_signal_previous_state
132
null
buiapp/reaktiv
from reaktiv import Signal, Linked, Effect def test_linked_decorator_manual_override() -> None: """Test that manual values persist until source changes.""" source = Signal(0) @Linked def counter() -> int: return source() assert counter() ==
0
assert
numeric_literal
tests/test_linked_decorator.py
test_linked_decorator_manual_override
107
null
buiapp/reaktiv
import pytest import threading import time from concurrent.futures import ThreadPoolExecutor, as_completed from reaktiv import ( Signal, ComputeSignal, Effect, set_thread_safety, is_thread_safety_enabled, ) class TestComputedSignalThreadSafety: def test_computed_signal_with_changing_dependenc...
30
assert
numeric_literal
tests/test_thread_safety.py
test_computed_signal_with_changing_dependency
TestComputedSignalThreadSafety
257
null
buiapp/reaktiv
from reaktiv import Signal, Computed, Effect def test_decorator_complex_computation() -> None: """Test decorator with complex computation logic.""" numbers = Signal([1, 2, 3, 4, 5]) @Computed def statistics() -> dict: nums = numbers() return { "sum": sum(nums), ...
60
assert
numeric_literal
tests/test_computed_decorator.py
test_decorator_complex_computation
198
null
buiapp/reaktiv
import gc from reaktiv import Signal, Effect def test_effect_gc_cleans_up_edges(): """When an effect is GC'd, it should clean up its edges from signals.""" signal = Signal(0) # Create and GC an effect Effect(lambda: signal()) gc.collect() # The signal's targets list should be empty or...
[1, 2]
assert
collection
tests/test_weakref_effects.py
test_effect_gc_cleans_up_edges
96
null
buiapp/reaktiv
import asyncio import pytest import pytest_asyncio from reaktiv import ( Signal, Resource, ResourceStatus, Computed, ) _resources = [] async def cleanup_resources(): """Automatically clean up resources after each test.""" _resources.clear() yield # Cancel all pending tasks from resourc...
"user3"
assert
string_literal
tests/test_resource.py
test_resource_abort_on_params_change
169
null
buiapp/reaktiv
from typing import List import asyncio import pytest from reaktiv import Signal, Computed, Effect, batch def test_complex_dependency_chain(): """Test a more complex dependency chain with multiple levels and branches.""" # Arrange trigger_count = 0 # Create a dependency chain: # a → b → d → # ...
4
assert
numeric_literal
tests/test_effect_triggers.py
test_complex_dependency_chain
91
null
buiapp/reaktiv
from reaktiv import Signal, Linked, Effect def test_linked_decorator_basic() -> None: """Test basic @Linked decorator usage.""" source = Signal(5) @Linked def derived() -> int: return source() * 2 assert derived() ==
10
assert
numeric_literal
tests/test_linked_decorator.py
test_linked_decorator_basic
14
null
buiapp/reaktiv
from reaktiv import Signal, Computed, Effect def test_decorator_basic() -> None: """Test basic @Computed decorator usage.""" count = Signal(5) @Computed def double() -> int: return count() * 2 assert double() ==
10
assert
numeric_literal
tests/test_computed_decorator.py
test_decorator_basic
13
null
buiapp/reaktiv
import gc import weakref from reaktiv import Signal, Effect def test_cleanup_runs_on_gc(): """Cleanup function should run when Effect is garbage collected.""" cleanup_ran = [] signal = Signal(0) def effect_fn(): signal() def cleanup(): cleanup_ran.append("cleanup execut...
None
assert
none_literal
tests/test_effect_del_cleanup.py
test_cleanup_runs_on_gc
28
null
buiapp/reaktiv
import pytest import asyncio from reaktiv import Signal, Effect, ComputeSignal, batch, untracked from reaktiv._debug import set_debug set_debug(True) @pytest.mark.asyncio async def test_compute_signal_dependencies(): a = Signal(2) b = Signal(3) sum_signal = ComputeSignal(lambda: a.get() + b.get()) ass...
9
assert
numeric_literal
tests/test_signals.py
test_compute_signal_dependencies
205
null
buiapp/reaktiv
import pytest from reaktiv import Signal, Computed, Effect def test_indirect_circular_dependency(): """Test detection of a more complex circular dependency with valid dependencies mixed in.""" # Create a valid base signal base = Signal(10) # Create some valid computed signals valid1 = Computed(lam...
RuntimeError, match="Circular dependency detected")
pytest.raises
complex_expr
tests/test_circular_dependency.py
test_indirect_circular_dependency
92
null
buiapp/reaktiv
from reaktiv import Signal, Linked, Effect def test_linked_update_method() -> None: """Test that update method works with decorated linked signals.""" source = Signal(5) @Linked def counter() -> int: return source() # Access to initialize assert counter() == 5 # Update using func...
15
assert
numeric_literal
tests/test_linked_decorator.py
test_linked_update_method
194
null
buiapp/reaktiv
from typing import List import asyncio import pytest from reaktiv import Signal, Computed, Effect, batch def test_effect_trigger_count(): """Test that an effect is only triggered once when changing a signal that multiple computed signals depend on.""" # Arrange trigger_count = 0 recorded_values: List[s...
2
assert
numeric_literal
tests/test_effect_triggers.py
test_effect_trigger_count
34
null
buiapp/reaktiv
import gc import weakref from reaktiv import Signal, Effect def test_cleanup_runs_on_gc(): """Cleanup function should run when Effect is garbage collected.""" cleanup_ran = [] signal = Signal(0) def effect_fn(): signal() def cleanup(): cleanup_ran.append("cleanup execut...
"cleanup executed"
assert
string_literal
tests/test_effect_del_cleanup.py
test_cleanup_runs_on_gc
32
null
buiapp/reaktiv
from reaktiv import Signal, Computed, Effect def test_decorator_with_equality() -> None: """Test @Computed decorator with custom equality function.""" count = Signal(5) call_count = 0 def int_equal(a: int, b: int) -> bool: return a == b @Computed(equal=int_equal) def double() -> int: ...
1
assert
numeric_literal
tests/test_computed_decorator.py
test_decorator_with_equality
33
null
buiapp/reaktiv
import pytest import threading import time from concurrent.futures import ThreadPoolExecutor, as_completed from reaktiv import ( Signal, ComputeSignal, Effect, set_thread_safety, is_thread_safety_enabled, ) class TestThreadSafetyConfiguration: def test_set_thread_safety_disable(self): ...
False
assert
bool_literal
tests/test_thread_safety.py
test_set_thread_safety_disable
TestThreadSafetyConfiguration
37
null
buiapp/reaktiv
import pytest from reaktiv import Signal, Computed, Effect def test_circular_dependency_mixed_with_valid_dependencies(): """Test circular dependency detection when mixed with valid signal dependencies.""" # Create valid base signals x = Signal(10) y = Signal(20) # Create valid computed signals ...
75
assert
numeric_literal
tests/test_circular_dependency.py
test_circular_dependency_mixed_with_valid_dependencies
300
null
buiapp/reaktiv
import pytest import threading import time from concurrent.futures import ThreadPoolExecutor, as_completed from reaktiv import ( Signal, ComputeSignal, Effect, set_thread_safety, is_thread_safety_enabled, ) class TestThreadSafetyStressTests: def test_complex_reactive_system_stress(self): ...
10
assert
numeric_literal
tests/test_thread_safety.py
test_complex_reactive_system_stress
TestThreadSafetyStressTests
830
null
buiapp/reaktiv
from typing import List import asyncio import pytest from reaktiv import Signal, Computed, Effect, batch def test_effect_trigger_count(): """Test that an effect is only triggered once when changing a signal that multiple computed signals depend on.""" # Arrange trigger_count = 0 recorded_values: List[s...
1
assert
numeric_literal
tests/test_effect_triggers.py
test_effect_trigger_count
33
null
buiapp/reaktiv
import pytest import threading import time from concurrent.futures import ThreadPoolExecutor, as_completed from reaktiv import ( Signal, ComputeSignal, Effect, set_thread_safety, is_thread_safety_enabled, ) class TestThreadPoolIntegration: def test_thread_pool_signal_updates(self): ""...
20
assert
numeric_literal
tests/test_thread_safety.py
test_thread_pool_signal_updates
TestThreadPoolIntegration
1,006
null
buiapp/reaktiv
import pytest from unittest.mock import Mock from reaktiv import Signal, ComputeSignal from reaktiv._debug import set_debug set_debug(True) def test_dependency_tracking(): """Test dependencies are only tracked after first access""" source = Signal(10) compute_fn = Mock(side_effect=lambda: source.get() * 2...
1
assert
numeric_literal
tests/test_lazy_computed.py
test_dependency_tracking
39
null
buiapp/reaktiv
import pytest from unittest.mock import Mock from reaktiv import Signal, ComputeSignal from reaktiv._debug import set_debug set_debug(True) def test_nested_computations(): """Test nested computed signals only compute when needed""" a = Signal(1) compute_b_fn = Mock(side_effect=lambda: a.get() * 2) b =...
7
assert
numeric_literal
tests/test_lazy_computed.py
test_nested_computations
117
null
buiapp/reaktiv
import pytest from reaktiv import Signal, Computed, Effect def test_no_false_positive_cycle_detection(): """Test that valid dependency chains don't trigger false positive cycle detection.""" # Create a valid chain: base -> level1 -> level2 -> level3 base = Signal(1) level1 = Computed(lambda: base() + 1...
4
assert
numeric_literal
tests/test_circular_dependency.py
test_no_false_positive_cycle_detection
176
null
buiapp/reaktiv
import pytest from unittest.mock import Mock from reaktiv import Signal, ComputeSignal from reaktiv._debug import set_debug set_debug(True) @pytest.mark.asyncio async def test_lazy_initialization(): """Test that computation only happens on first access""" compute_fn = Mock(return_value=42) computed = Comp...
42
assert
numeric_literal
tests/test_lazy_computed.py
test_lazy_initialization
19
null
buiapp/reaktiv
import pytest from unittest.mock import Mock from reaktiv import Signal, ComputeSignal from reaktiv._debug import set_debug set_debug(True) def test_recomputation_on_dependency_change(): """Test value updates only when accessed after change""" source = Signal(5) computed = ComputeSignal(lambda: source.get...
30
assert
numeric_literal
tests/test_lazy_computed.py
test_recomputation_on_dependency_change
55
null
buiapp/reaktiv
import pytest import asyncio from reaktiv import Signal, Computed, Effect, batch @pytest.mark.asyncio async def test_batch_effect_notifications(): """Test that effects are only triggered once after a batch update completes.""" # Setup simple counter signals x = Signal(5) y = Signal(10) sum_xy = Co...
(28, 160)
assert
collection
tests/test_batch_notifications.py
test_batch_effect_notifications
48
null
buiapp/reaktiv
import pytest import asyncio from reaktiv import Signal, Effect, ComputeSignal, batch, untracked from reaktiv._debug import set_debug set_debug(True) @pytest.mark.asyncio async def test_basic_effect_execution(): signal = Signal(0) execution_count = 0 async def test_effect(): nonlocal execution_co...
2
assert
numeric_literal
tests/test_signals.py
test_basic_effect_execution
38
null
buiapp/reaktiv
import pytest import threading import time from concurrent.futures import ThreadPoolExecutor, as_completed from reaktiv import ( Signal, ComputeSignal, Effect, set_thread_safety, is_thread_safety_enabled, ) class TestBasicSignalThreadSafety: def test_concurrent_signal_reads(self): """...
1
assert
numeric_literal
tests/test_thread_safety.py
test_concurrent_signal_reads
TestBasicSignalThreadSafety
109
null
buiapp/reaktiv
import pytest import asyncio from reaktiv import Signal, Effect, ComputeSignal @pytest.mark.asyncio async def test_computed_signal_custom_equality(): """Test that computed signals work with custom equality functions.""" # Define a simpler custom equality function for testing def within_tolerance(a, b, tol...
0
assert
numeric_literal
tests/test_custom_equality.py
test_computed_signal_custom_equality
130
null
buiapp/reaktiv
import pytest import asyncio from unittest.mock import Mock from reaktiv import Signal, ComputeSignal, Effect, batch class TestBatchPerformance: @pytest.mark.asyncio async def test_no_unnecessary_computations_in_batch(self): """Test that computed signals don't recompute unnecessarily during batch proc...
5
assert
numeric_literal
tests/test_batch_performance.py
test_no_unnecessary_computations_in_batch
TestBatchPerformance
33
null
buiapp/reaktiv
import pytest import threading import time from concurrent.futures import ThreadPoolExecutor, as_completed from reaktiv import ( Signal, ComputeSignal, Effect, set_thread_safety, is_thread_safety_enabled, ) class TestEffectThreadSafety: def test_effect_execution_with_concurrent_updates(self):...
0
assert
numeric_literal
tests/test_thread_safety.py
test_effect_execution_with_concurrent_updates
TestEffectThreadSafety
330
null
buiapp/reaktiv
from reaktiv import Signal, Computed, Effect def test_decorator_with_effect() -> None: """Test that decorated computed signals work with effects.""" count = Signal(5) effect_values = [] @Computed def double() -> int: return count() * 2 def track_double() -> None: effect_values...
[10]
assert
collection
tests/test_computed_decorator.py
test_decorator_with_effect
118
null
buiapp/reaktiv
from reaktiv import Signal, Linked, Effect def test_linked_decorator_chaining() -> None: """Test chaining multiple linked signals.""" base = Signal(1) @Linked def first() -> int: return base() * 2 @Linked def second() -> int: return first() * 3 assert second() ==
6
assert
numeric_literal
tests/test_linked_decorator.py
test_linked_decorator_chaining
133
null
buiapp/reaktiv
import pytest from unittest.mock import Mock from reaktiv import Signal, ComputeSignal from reaktiv._debug import set_debug set_debug(True) def test_multiple_dependencies(): """Test complex dependency graph only computes when accessed""" a = Signal(1) b = Signal(2) compute_fn = Mock(side_effect=lambda...
3
assert
numeric_literal
tests/test_lazy_computed.py
test_multiple_dependencies
69
null
buiapp/reaktiv
import pytest import threading import time from concurrent.futures import ThreadPoolExecutor, as_completed from reaktiv import ( Signal, ComputeSignal, Effect, set_thread_safety, is_thread_safety_enabled, ) class TestThreadSafetyConfiguration: def test_thread_safety_default_enabled(self): ...
True
assert
bool_literal
tests/test_thread_safety.py
test_thread_safety_default_enabled
TestThreadSafetyConfiguration
25
null
buiapp/reaktiv
import pytest from reaktiv import Signal, Computed, Effect def test_no_false_positive_cycle_detection(): """Test that valid dependency chains don't trigger false positive cycle detection.""" # Create a valid chain: base -> level1 -> level2 -> level3 base = Signal(1) level1 = Computed(lambda: base() + 1...
3
assert
numeric_literal
tests/test_circular_dependency.py
test_no_false_positive_cycle_detection
175
null
buiapp/reaktiv
import pytest from reaktiv import Signal, Computed, Effect def test_circular_dependency_with_effect(): """Test that effects can depend on signals with circular dependencies without issues.""" # Create a valid signal source = Signal(5) valid_computed = Computed(lambda: source() * 2) # Create circul...
2
assert
numeric_literal
tests/test_circular_dependency.py
test_circular_dependency_with_effect
129
null
buiapp/reaktiv
import pytest from reaktiv import Signal, Computed, Effect def test_circular_dependency_mixed_with_valid_dependencies(): """Test circular dependency detection when mixed with valid signal dependencies.""" # Create valid base signals x = Signal(10) y = Signal(20) # Create valid computed signals ...
200
assert
numeric_literal
tests/test_circular_dependency.py
test_circular_dependency_mixed_with_valid_dependencies
286
null
buiapp/reaktiv
import pytest import asyncio from reaktiv import Signal, Computed, Effect, batch @pytest.mark.asyncio async def test_batch_sync_effect_notifications(): """Test that synchronous effects are only triggered once after a batch update completes.""" # Setup simple counter signals a = Signal(1) b = Signal(2) ...
(3, -1)
assert
collection
tests/test_batch_notifications.py
test_batch_sync_effect_notifications
87
null
buiapp/reaktiv
import asyncio import pytest import pytest_asyncio from reaktiv import ( Signal, Resource, ResourceStatus, Computed, ) _resources = [] async def cleanup_resources(): """Automatically clean up resources after each test.""" _resources.clear() yield # Cancel all pending tasks from resourc...
1
assert
numeric_literal
tests/test_resource.py
test_resource_basic_loading
67
null
buiapp/reaktiv
import pytest from unittest.mock import Mock from reaktiv import Signal, ComputeSignal from reaktiv._debug import set_debug set_debug(True) def test_multiple_dependencies(): """Test complex dependency graph only computes when accessed""" a = Signal(1) b = Signal(2) compute_fn = Mock(side_effect=lambda...
2
assert
numeric_literal
tests/test_lazy_computed.py
test_multiple_dependencies
81
null
buiapp/reaktiv
import pytest import asyncio from reaktiv import Signal, Computed, Effect, batch @pytest.mark.asyncio async def test_batch_effect_notifications(): """Test that effects are only triggered once after a batch update completes.""" # Setup simple counter signals x = Signal(5) y = Signal(10) sum_xy = Co...
1
assert
numeric_literal
tests/test_batch_notifications.py
test_batch_effect_notifications
29
null
buiapp/reaktiv
import gc from reaktiv import Signal, Effect def test_effect_weakref_with_batching(): """Weak references should work correctly with batching.""" from reaktiv import batch signal1 = Signal(0) signal2 = Signal(0) effect_runs = [] # Effect without reference Effect(lambda: effect_runs...
[(0, 0)]
assert
collection
tests/test_weakref_effects.py
test_effect_weakref_with_batching
129
null
buiapp/reaktiv
from reaktiv import Signal, Computed, Effect def test_decorator_basic() -> None: """Test basic @Computed decorator usage.""" count = Signal(5) @Computed def double() -> int: return count() * 2 assert double() == 10 count.set(10) assert double() ==
20
assert
numeric_literal
tests/test_computed_decorator.py
test_decorator_basic
15
null
buiapp/reaktiv
import asyncio import pytest import pytest_asyncio from reaktiv import ( Signal, Resource, ResourceStatus, Computed, ) _resources = [] async def cleanup_resources(): """Automatically clean up resources after each test.""" _resources.clear() yield # Cancel all pending tasks from resourc...
"user1"
assert
string_literal
tests/test_resource.py
test_resource_params_change
88
null
buiapp/reaktiv
import asyncio import pytest import pytest_asyncio from reaktiv import ( Signal, Resource, ResourceStatus, Computed, ) _resources = [] async def cleanup_resources(): """Automatically clean up resources after each test.""" _resources.clear() yield # Cancel all pending tasks from resourc...
None
assert
none_literal
tests/test_resource.py
test_resource_error_handling
199
null
buiapp/reaktiv
import pytest from reaktiv import Signal, Computed, Effect def test_circular_dependency_error_message(): """Test that the error message for circular dependency is clear and helpful.""" def compute_a(): return b() + 1 def compute_b(): return a() + 1 a = Computed(compute_a) b = Com...
"Circular dependency detected"
assert
string_literal
tests/test_circular_dependency.py
test_circular_dependency_error_message
201
null
buiapp/reaktiv
import gc import weakref from reaktiv import Signal, Effect def test_cleanup_with_on_cleanup_parameter(): """Cleanup registered via on_cleanup should run on GC.""" cleanup_ran = [] signal = Signal(0) def effect_fn(on_cleanup): signal() on_cleanup(lambda: cleanup_ran.append("on_clea...
"on_cleanup executed"
assert
string_literal
tests/test_effect_del_cleanup.py
test_cleanup_with_on_cleanup_parameter
52
null
buiapp/reaktiv
import gc import weakref from reaktiv import Signal, Effect def test_cleanup_runs_on_gc(): """Cleanup function should run when Effect is garbage collected.""" cleanup_ran = [] signal = Signal(0) def effect_fn(): signal() def cleanup(): cleanup_ran.append("cleanup execut...
1
assert
numeric_literal
tests/test_effect_del_cleanup.py
test_cleanup_runs_on_gc
31
null
buiapp/reaktiv
import gc from reaktiv import Signal, Effect def test_effect_with_reference_stays_alive(): """Effects with external references should stay alive until reference is removed.""" signal = Signal(0) effect_runs = [] # Keep reference to effect effect = Effect(lambda: effect_runs.append(signal())) ...
[0, 1]
assert
collection
tests/test_weakref_effects.py
test_effect_with_reference_stays_alive
39
null
buiapp/reaktiv
import pytest import asyncio from reaktiv import Signal, Effect, ComputeSignal, batch, untracked from reaktiv.linked import LinkedSignal from reaktiv._debug import set_debug set_debug(True) def test_linked_signal_initialization_patterns(): """Test different initialization patterns for LinkedSignal""" # Patter...
1
assert
numeric_literal
tests/test_linked_signal.py
test_linked_signal_initialization_patterns
89
null
buiapp/reaktiv
import pytest import asyncio from reaktiv import Signal, Effect, ComputeSignal, batch, untracked from reaktiv._debug import set_debug set_debug(True) @pytest.mark.asyncio async def test_signal_set_value(): signal = Signal(0) signal.set(5) assert signal.get() ==
5
assert
numeric_literal
tests/test_signals.py
test_signal_set_value
19
null
buiapp/reaktiv
import pytest import asyncio from reaktiv import Signal, Computed, Effect, batch @pytest.mark.asyncio async def test_batch_sync_effect_notifications(): """Test that synchronous effects are only triggered once after a batch update completes.""" # Setup simple counter signals a = Signal(1) b = Signal(2) ...
(8, 2)
assert
collection
tests/test_batch_notifications.py
test_batch_sync_effect_notifications
102
null
buiapp/reaktiv
import pytest from unittest.mock import Mock from reaktiv import Signal, ComputeSignal from reaktiv._debug import set_debug set_debug(True) def test_dependency_tracking(): """Test dependencies are only tracked after first access""" source = Signal(10) compute_fn = Mock(side_effect=lambda: source.get() * 2...
20
assert
numeric_literal
tests/test_lazy_computed.py
test_dependency_tracking
37
null
buiapp/reaktiv
import pytest from unittest.mock import Mock from reaktiv import Signal, ComputeSignal from reaktiv._debug import set_debug set_debug(True) def test_error_handling(): """Test errors in computation are propagated to the caller""" compute_fn = Mock(side_effect=RuntimeError("Oops")) computed = ComputeSignal(...
RuntimeError, match="Oops")
pytest.raises
complex_expr
tests/test_lazy_computed.py
test_error_handling
90
null
buiapp/reaktiv
import gc from reaktiv import Signal, Effect def test_effect_without_reference_immediate_gc(): """Effects without external references should be garbage collected immediately.""" signal = Signal(0) effect_runs = [] # Create effect without storing reference - should GC immediately after creation ...
[0]
assert
collection
tests/test_weakref_effects.py
test_effect_without_reference_immediate_gc
20
null
buiapp/reaktiv
import pytest from reaktiv import Signal, Computed, Effect def test_circular_dependency_mixed_with_valid_dependencies(): """Test circular dependency detection when mixed with valid signal dependencies.""" # Create valid base signals x = Signal(10) y = Signal(20) # Create valid computed signals ...
30
assert
numeric_literal
tests/test_circular_dependency.py
test_circular_dependency_mixed_with_valid_dependencies
285
null
buiapp/reaktiv
from reaktiv import Signal, Linked, Effect def test_linked_decorator_chaining() -> None: """Test chaining multiple linked signals.""" base = Signal(1) @Linked def first() -> int: return base() * 2 @Linked def second() -> int: return first() * 3 assert second() == 6 #...
4
assert
numeric_literal
tests/test_linked_decorator.py
test_linked_decorator_chaining
141
null