mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 08:00:54 +00:00
fix all tests
This commit is contained in:
@ -86,102 +86,102 @@ async def test_simple_two_nodes():
|
||||
|
||||
await perform_test(num_nodes, adj_map, action_func, assertion_func)
|
||||
|
||||
# @pytest.mark.asyncio
|
||||
# async def test_simple_three_nodes_line_topography():
|
||||
# num_nodes = 3
|
||||
# adj_map = {0: [1], 1: [2]}
|
||||
@pytest.mark.asyncio
|
||||
async def test_simple_three_nodes_line_topography():
|
||||
num_nodes = 3
|
||||
adj_map = {0: [1], 1: [2]}
|
||||
|
||||
# async def action_func(dummy_nodes):
|
||||
# await dummy_nodes[0].publish_set_crypto("aspyn", 10)
|
||||
async def action_func(dummy_nodes):
|
||||
await dummy_nodes[0].publish_set_crypto("aspyn", 10)
|
||||
|
||||
# def assertion_func(dummy_node):
|
||||
# assert dummy_node.get_balance("aspyn") == 10
|
||||
def assertion_func(dummy_node):
|
||||
assert dummy_node.get_balance("aspyn") == 10
|
||||
|
||||
# await perform_test(num_nodes, adj_map, action_func, assertion_func)
|
||||
await perform_test(num_nodes, adj_map, action_func, assertion_func)
|
||||
|
||||
# @pytest.mark.asyncio
|
||||
# async def test_simple_three_nodes_triangle_topography():
|
||||
# num_nodes = 3
|
||||
# adj_map = {0: [1, 2], 1: [2]}
|
||||
@pytest.mark.asyncio
|
||||
async def test_simple_three_nodes_triangle_topography():
|
||||
num_nodes = 3
|
||||
adj_map = {0: [1, 2], 1: [2]}
|
||||
|
||||
# async def action_func(dummy_nodes):
|
||||
# await dummy_nodes[0].publish_set_crypto("aspyn", 20)
|
||||
async def action_func(dummy_nodes):
|
||||
await dummy_nodes[0].publish_set_crypto("aspyn", 20)
|
||||
|
||||
# def assertion_func(dummy_node):
|
||||
# assert dummy_node.get_balance("aspyn") == 20
|
||||
def assertion_func(dummy_node):
|
||||
assert dummy_node.get_balance("aspyn") == 20
|
||||
|
||||
# await perform_test(num_nodes, adj_map, action_func, assertion_func)
|
||||
await perform_test(num_nodes, adj_map, action_func, assertion_func)
|
||||
|
||||
# @pytest.mark.asyncio
|
||||
# async def test_simple_seven_nodes_tree_topography():
|
||||
# num_nodes = 7
|
||||
# adj_map = {0: [1, 2], 1: [3, 4], 2: [5, 6]}
|
||||
@pytest.mark.asyncio
|
||||
async def test_simple_seven_nodes_tree_topography():
|
||||
num_nodes = 7
|
||||
adj_map = {0: [1, 2], 1: [3, 4], 2: [5, 6]}
|
||||
|
||||
# async def action_func(dummy_nodes):
|
||||
# await dummy_nodes[0].publish_set_crypto("aspyn", 20)
|
||||
async def action_func(dummy_nodes):
|
||||
await dummy_nodes[0].publish_set_crypto("aspyn", 20)
|
||||
|
||||
# def assertion_func(dummy_node):
|
||||
# assert dummy_node.get_balance("aspyn") == 20
|
||||
def assertion_func(dummy_node):
|
||||
assert dummy_node.get_balance("aspyn") == 20
|
||||
|
||||
# await perform_test(num_nodes, adj_map, action_func, assertion_func)
|
||||
await perform_test(num_nodes, adj_map, action_func, assertion_func)
|
||||
|
||||
# @pytest.mark.asyncio
|
||||
# async def test_set_then_send_from_root_seven_nodes_tree_topography():
|
||||
# num_nodes = 7
|
||||
# adj_map = {0: [1, 2], 1: [3, 4], 2: [5, 6]}
|
||||
@pytest.mark.asyncio
|
||||
async def test_set_then_send_from_root_seven_nodes_tree_topography():
|
||||
num_nodes = 7
|
||||
adj_map = {0: [1, 2], 1: [3, 4], 2: [5, 6]}
|
||||
|
||||
# async def action_func(dummy_nodes):
|
||||
# await dummy_nodes[0].publish_set_crypto("aspyn", 20)
|
||||
# await asyncio.sleep(0.25)
|
||||
# await dummy_nodes[0].publish_send_crypto("aspyn", "alex", 5)
|
||||
async def action_func(dummy_nodes):
|
||||
await dummy_nodes[0].publish_set_crypto("aspyn", 20)
|
||||
await asyncio.sleep(0.25)
|
||||
await dummy_nodes[0].publish_send_crypto("aspyn", "alex", 5)
|
||||
|
||||
# def assertion_func(dummy_node):
|
||||
# assert dummy_node.get_balance("aspyn") == 15
|
||||
# assert dummy_node.get_balance("alex") == 5
|
||||
def assertion_func(dummy_node):
|
||||
assert dummy_node.get_balance("aspyn") == 15
|
||||
assert dummy_node.get_balance("alex") == 5
|
||||
|
||||
# await perform_test(num_nodes, adj_map, action_func, assertion_func)
|
||||
await perform_test(num_nodes, adj_map, action_func, assertion_func)
|
||||
|
||||
# @pytest.mark.asyncio
|
||||
# async def test_set_then_send_from_different_leafs_seven_nodes_tree_topography():
|
||||
# num_nodes = 7
|
||||
# adj_map = {0: [1, 2], 1: [3, 4], 2: [5, 6]}
|
||||
@pytest.mark.asyncio
|
||||
async def test_set_then_send_from_different_leafs_seven_nodes_tree_topography():
|
||||
num_nodes = 7
|
||||
adj_map = {0: [1, 2], 1: [3, 4], 2: [5, 6]}
|
||||
|
||||
# async def action_func(dummy_nodes):
|
||||
# await dummy_nodes[6].publish_set_crypto("aspyn", 20)
|
||||
# await asyncio.sleep(0.25)
|
||||
# await dummy_nodes[4].publish_send_crypto("aspyn", "alex", 5)
|
||||
async def action_func(dummy_nodes):
|
||||
await dummy_nodes[6].publish_set_crypto("aspyn", 20)
|
||||
await asyncio.sleep(0.25)
|
||||
await dummy_nodes[4].publish_send_crypto("aspyn", "alex", 5)
|
||||
|
||||
# def assertion_func(dummy_node):
|
||||
# assert dummy_node.get_balance("aspyn") == 15
|
||||
# assert dummy_node.get_balance("alex") == 5
|
||||
def assertion_func(dummy_node):
|
||||
assert dummy_node.get_balance("aspyn") == 15
|
||||
assert dummy_node.get_balance("alex") == 5
|
||||
|
||||
# await perform_test(num_nodes, adj_map, action_func, assertion_func)
|
||||
await perform_test(num_nodes, adj_map, action_func, assertion_func)
|
||||
|
||||
# @pytest.mark.asyncio
|
||||
# async def test_simple_five_nodes_ring_topography():
|
||||
# num_nodes = 5
|
||||
# adj_map = {0: [1], 1: [2], 2: [3], 3: [4], 4: [0]}
|
||||
@pytest.mark.asyncio
|
||||
async def test_simple_five_nodes_ring_topography():
|
||||
num_nodes = 5
|
||||
adj_map = {0: [1], 1: [2], 2: [3], 3: [4], 4: [0]}
|
||||
|
||||
# async def action_func(dummy_nodes):
|
||||
# await dummy_nodes[0].publish_set_crypto("aspyn", 20)
|
||||
async def action_func(dummy_nodes):
|
||||
await dummy_nodes[0].publish_set_crypto("aspyn", 20)
|
||||
|
||||
# def assertion_func(dummy_node):
|
||||
# assert dummy_node.get_balance("aspyn") == 20
|
||||
def assertion_func(dummy_node):
|
||||
assert dummy_node.get_balance("aspyn") == 20
|
||||
|
||||
# await perform_test(num_nodes, adj_map, action_func, assertion_func)
|
||||
await perform_test(num_nodes, adj_map, action_func, assertion_func)
|
||||
|
||||
# @pytest.mark.asyncio
|
||||
# async def test_set_then_send_from_diff_nodes_five_nodes_ring_topography():
|
||||
# num_nodes = 5
|
||||
# adj_map = {0: [1], 1: [2], 2: [3], 3: [4], 4: [0]}
|
||||
@pytest.mark.asyncio
|
||||
async def test_set_then_send_from_diff_nodes_five_nodes_ring_topography():
|
||||
num_nodes = 5
|
||||
adj_map = {0: [1], 1: [2], 2: [3], 3: [4], 4: [0]}
|
||||
|
||||
# async def action_func(dummy_nodes):
|
||||
# await dummy_nodes[0].publish_set_crypto("alex", 20)
|
||||
# await asyncio.sleep(0.25)
|
||||
# await dummy_nodes[3].publish_send_crypto("alex", "rob", 12)
|
||||
async def action_func(dummy_nodes):
|
||||
await dummy_nodes[0].publish_set_crypto("alex", 20)
|
||||
await asyncio.sleep(0.25)
|
||||
await dummy_nodes[3].publish_send_crypto("alex", "rob", 12)
|
||||
|
||||
# def assertion_func(dummy_node):
|
||||
# assert dummy_node.get_balance("alex") == 8
|
||||
# assert dummy_node.get_balance("rob") == 12
|
||||
def assertion_func(dummy_node):
|
||||
assert dummy_node.get_balance("alex") == 8
|
||||
assert dummy_node.get_balance("rob") == 12
|
||||
|
||||
# await perform_test(num_nodes, adj_map, action_func, assertion_func)
|
||||
await perform_test(num_nodes, adj_map, action_func, assertion_func)
|
||||
|
||||
Reference in New Issue
Block a user