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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_config.py | test_config_set | assert | variable | 18 | import pytest
from netmiko import ConfigInvalidException
def test_config_set(net_connect, commands, expected_responses):
"""Test sending configuration commands."""
config_commands = commands["config"]
support_commit = commands.get("support_commit")
config_verify = commands["config_verification"]
#... | config_commands_output | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_config.py | test_config_error_pattern | pytest.raises | variable | 20 | import pytest
from netmiko import ConfigInvalidException
def test_config_error_pattern(net_connect, commands, expected_responses):
"""
Raise exception when config_error_str is present in output
"""
error_pattern = commands.get("error_pattern")
if error_pattern is None:
pytest.skip("No error... | ConfigInvalidException) | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_config.py | test_enable_mode | assert | complex_expr | 14 | import pytest
from netmiko import ConfigInvalidException
def test_enable_mode(net_connect, commands, expected_responses):
"""
Test entering enable mode
Catch exception for devices that don't support enable
"""
try:
net_connect.enable()
enable_prompt = net_connect.find_prompt()
... | expected_responses["enable_prompt"] | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_config_acl.py | test_large_acl | assert | func_call | 67 | import re
import pytest
from network_utilities import generate_ios_acl
from network_utilities import generate_cisco_nxos_acl # noqa
from network_utilities import generate_cisco_asa_acl # noqa
from network_utilities import generate_cisco_xr_acl # noqa
from network_utilities import generate_arista_eos_acl # noqa
from... | len(cfg_lines) | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_config_acl.py | test_large_acl | assert | func_call | 56 | import re
import pytest
from network_utilities import generate_ios_acl
from network_utilities import generate_cisco_nxos_acl # noqa
from network_utilities import generate_cisco_asa_acl # noqa
from network_utilities import generate_cisco_xr_acl # noqa
from network_utilities import generate_arista_eos_acl # noqa
from... | len(cfg_lines) + offset | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_exceptions.py | test_conn_timeout | assert | numeric_literal | 21 | from os import path
from datetime import datetime
import pytest
from netmiko import ConnectHandler
from netmiko import NetmikoTimeoutException
from test_utils import parse_yaml
PWD = path.dirname(path.realpath(__file__))
DEVICE_DICT = parse_yaml(PWD + "/etc/test_devices_exc.yml")
def test_conn_timeout():
device =... | 5.0 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_exceptions.py | test_conn_timeout | assert | numeric_literal | 22 | from os import path
from datetime import datetime
import pytest
from netmiko import ConnectHandler
from netmiko import NetmikoTimeoutException
from test_utils import parse_yaml
PWD = path.dirname(path.realpath(__file__))
DEVICE_DICT = parse_yaml(PWD + "/etc/test_devices_exc.yml")
def test_conn_timeout():
device =... | 5.1 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_exceptions.py | test_dns_fail_timeout | assert | numeric_literal | 25 | from os import path
from datetime import datetime
import pytest
from netmiko import ConnectHandler
from netmiko import NetmikoTimeoutException
from test_utils import parse_yaml
PWD = path.dirname(path.realpath(__file__))
DEVICE_DICT = parse_yaml(PWD + "/etc/test_devices_exc.yml")
def test_dns_fail_timeout():
"""S... | 0.1 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_exceptions.py | test_dns_fail_timeout | assert | func_call | 21 | from os import path
from datetime import datetime
import pytest
from netmiko import ConnectHandler
from netmiko import NetmikoTimeoutException
from test_utils import parse_yaml
PWD = path.dirname(path.realpath(__file__))
DEVICE_DICT = parse_yaml(PWD + "/etc/test_devices_exc.yml")
def test_dns_fail_timeout():
"""S... | str(e) | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_exceptions.py | test_valid_conn | assert | string_literal | 16 | from os import path
from datetime import datetime
import pytest
from netmiko import ConnectHandler
from netmiko import NetmikoTimeoutException
from test_utils import parse_yaml
PWD = path.dirname(path.realpath(__file__))
DEVICE_DICT = parse_yaml(PWD + "/etc/test_devices_exc.yml")
def test_valid_conn():
"""Verify ... | "cisco3#" | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_exceptions.py | test_conn_timeout | pytest.raises | variable | 17 | from os import path
from datetime import datetime
import pytest
from netmiko import ConnectHandler
from netmiko import NetmikoTimeoutException
from test_utils import parse_yaml
PWD = path.dirname(path.realpath(__file__))
DEVICE_DICT = parse_yaml(PWD + "/etc/test_devices_exc.yml")
def test_conn_timeout():
device =... | NetmikoTimeoutException) | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_save.py | test_save_base | assert | variable | 9 | def test_save_base(net_connect, commands, expected_responses):
"""
Test save config with no options.
"""
save_verify = expected_responses["save_config"]
cmd_response = net_connect.save_config()
assert save_verify in | cmd_response | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_scp.py | test_remote_file_size | assert | numeric_literal | 10 | import pytest
from netmiko import file_transfer
def test_remote_file_size(scp_fixture):
ssh_conn, scp_transfer = scp_fixture
if not scp_transfer.check_file_exists():
scp_transfer.put_file()
remote_file_size = scp_transfer.remote_file_size()
assert remote_file_size == | 19 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_scp.py | test_verify_space_available_put | assert | bool_literal | 7 | import pytest
from netmiko import file_transfer
def test_verify_space_available_put(scp_fixture):
ssh_conn, scp_transfer = scp_fixture
assert scp_transfer.verify_space_available() is | True | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_scp.py | test_verify_space_available_put | assert | bool_literal | 10 | import pytest
from netmiko import file_transfer
def test_verify_space_available_put(scp_fixture):
ssh_conn, scp_transfer = scp_fixture
assert scp_transfer.verify_space_available() is True
# intentional make there not be enough space available
scp_transfer.file_size = 100_000_000_000
assert scp_tra... | False | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_scp.py | test_md5_methods | assert | variable | 12 | import pytest
from netmiko import file_transfer
def test_md5_methods(scp_fixture):
ssh_conn, scp_transfer = scp_fixture
if "nokia_sros" in ssh_conn.device_type:
pytest.skip("MD5 not supported on this platform")
md5_value = "d8df36973ff832b564ad84642d07a261"
remote_md5 = scp_transfer.remote_md5... | md5_value | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_scp.py | test_file_transfer | pytest.raises | variable | 46 | import pytest
from netmiko import file_transfer
def test_file_transfer(scp_file_transfer):
"""Test Netmiko file_transfer function."""
ssh_conn, file_system = scp_file_transfer
platform = ssh_conn.device_type
source_file = f"test_{platform}/test9.txt"
dest_file = "test9.txt"
direction = "put"
... | Exception) | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_scp.py | test_local_space_available | assert | numeric_literal | 8 | import pytest
from netmiko import file_transfer
def test_local_space_available(scp_fixture):
ssh_conn, scp_transfer = scp_fixture
local_space = scp_transfer.local_space_available()
assert local_space >= | 1_000_000_000 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_scp.py | test_remote_space_available | assert | complex_expr | 8 | import pytest
from netmiko import file_transfer
def test_remote_space_available(scp_fixture, expected_responses):
ssh_conn, scp_transfer = scp_fixture
remote_space = scp_transfer.remote_space_available()
assert remote_space >= | expected_responses["scp_remote_space"] | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_session_log.py | read_session_log | assert | variable | 24 | import time
import hashlib
import io
from netmiko import ConnectHandler
def calc_md5(file_name=None, contents=None):
"""Compute MD5 hash of file."""
if contents is not None:
pass
elif file_name:
with open(file_name, "rb") as f:
contents = f.read()
else:
raise ValueEr... | line | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_session_log.py | test_session_log_secrets | assert | variable | 62 | import time
import hashlib
import io
from netmiko import ConnectHandler
def calc_md5(file_name=None, contents=None):
"""Compute MD5 hash of file."""
if contents is not None:
pass
elif file_name:
with open(file_name, "rb") as f:
contents = f.read()
else:
raise ValueEr... | session_log | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_session_log.py | session_log_md5 | assert | variable | 41 | import time
import hashlib
import io
from netmiko import ConnectHandler
def calc_md5(file_name=None, contents=None):
"""Compute MD5 hash of file."""
if contents is not None:
pass
elif file_name:
with open(file_name, "rb") as f:
contents = f.read()
else:
raise ValueEr... | compare_log_md5 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_show.py | test_disconnect | assert | numeric_literal | 13 | import pytest
import time
from datetime import datetime
def test_disconnect(net_connect, commands, expected_responses):
"""Terminate the SSH session."""
start_time = datetime.now()
net_connect.disconnect()
end_time = datetime.now()
time_delta = end_time - start_time
assert net_connect.remote_co... | 8 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_show.py | test_disconnect_no_enable | assert | numeric_literal | 16 | import pytest
import time
from datetime import datetime
def test_disconnect_no_enable(net_connect_newconn, commands, expected_responses):
"""Terminate the SSH session from privilege level1"""
net_connect = net_connect_newconn
if "cisco_ios" in net_connect.device_type:
net_connect.send_command_timin... | 5 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_show.py | test_send_multiline_timing | assert | numeric_literal | 20 | import pytest
import time
from datetime import datetime
def test_send_multiline_timing(net_connect):
debug = False
if (
"cisco_ios" not in net_connect.device_type
and "cisco_xe" not in net_connect.device_type
):
assert pytest.skip()
count = 100
cmd_list = ["ping", "", "8.8... | 95 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_show.py | test_clear_buffer | assert | none_literal | 15 | import pytest
import time
from datetime import datetime
def test_clear_buffer(net_connect, commands, expected_responses):
"""Test that clearing the buffer works."""
# Manually send a command down the channel so that data needs read.
net_connect.write_channel(commands["basic"] + "\n")
time.sleep(4)
... | None | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_show.py | test_send_multiline_prompt | assert | variable | 23 | import pytest
import time
from datetime import datetime
def test_send_multiline_prompt(net_connect):
"""Use send_multiline, but use device's prompt as expect_string"""
debug = False
if (
"cisco_ios" not in net_connect.device_type
and "cisco_xe" not in net_connect.device_type
):
... | output | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_show.py | test_send_command_timing | assert | variable | 12 | import pytest
import time
from datetime import datetime
def test_send_command_timing(net_connect, commands, expected_responses):
"""Verify a command can be sent down the channel successfully."""
time.sleep(1)
net_connect.clear_buffer()
# Force verification of command echo
show_ip = net_connect.send... | show_ip | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_show.py | test_ssh_connect_cm | assert | variable | 9 | import pytest
import time
from datetime import datetime
def test_ssh_connect_cm(net_connect_cm, commands, expected_responses):
"""Test the context manager."""
prompt_str = net_connect_cm
assert expected_responses["base_prompt"] in | prompt_str | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_show.py | test_send_command | assert | variable | 10 | import pytest
import time
from datetime import datetime
def test_send_command(net_connect, commands, expected_responses):
"""Verify a command can be sent down the channel successfully using send_command method."""
net_connect.clear_buffer()
show_ip_alt = net_connect.send_command(commands["basic"])
ass... | show_ip_alt | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_tcl.py | test_remote_file_size | assert | numeric_literal | 5 | def test_remote_file_size(tcl_fixture):
ssh_conn, transfer = tcl_fixture
remote_file_size = transfer.remote_file_size()
assert remote_file_size == | 20 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_tcl.py | test_verify_space_available_put | assert | bool_literal | 4 | def test_verify_space_available_put(tcl_fixture):
ssh_conn, transfer = tcl_fixture
assert transfer.verify_space_available() is | True | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_tcl.py | test_verify_space_available_put | assert | bool_literal | 7 | def test_verify_space_available_put(tcl_fixture):
ssh_conn, transfer = tcl_fixture
assert transfer.verify_space_available() is True
# intentional make there not be enough space available
transfer.file_size = 1000000000
assert transfer.verify_space_available() is | False | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_tcl.py | test_remote_space_available | assert | numeric_literal | 5 | def test_remote_space_available(tcl_fixture):
ssh_conn, transfer = tcl_fixture
remote_space = transfer.remote_space_available()
assert remote_space >= | 30000000 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_netmiko_tcl.py | test_md5_methods | assert | variable | 7 | def test_md5_methods(tcl_fixture):
ssh_conn, transfer = tcl_fixture
md5_value = "4313f1adae86a21117441b0a95d482a7"
remote_md5 = transfer.remote_md5()
assert remote_md5 == | md5_value | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_timeout_read_timing.py | test_read_traceroute | assert | numeric_literal | 27 | from datetime import datetime
def execute_cmd(conn, cmd="show tech-support", read_timeout=None, last_read=2.0):
start_time = datetime.now()
cmd = cmd.strip()
conn.write_channel(cmd + "\n")
if read_timeout is None:
output = conn.read_channel_timing(last_read=last_read)
else:
output =... | 5 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_timeout_read_timing.py | test_read_show_tech | assert | numeric_literal | 26 | from datetime import datetime
def execute_cmd(conn, cmd="show tech-support", read_timeout=None, last_read=2.0):
start_time = datetime.now()
cmd = cmd.strip()
conn.write_channel(cmd + "\n")
if read_timeout is None:
output = conn.read_channel_timing(last_read=last_read)
else:
output =... | 10 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_timeout_read_timing.py | test_read_traceroute_no_response | assert | numeric_literal | 29 | from datetime import datetime
def execute_cmd(conn, cmd="show tech-support", read_timeout=None, last_read=2.0):
start_time = datetime.now()
cmd = cmd.strip()
conn.write_channel(cmd + "\n")
if read_timeout is None:
output = conn.read_channel_timing(last_read=last_read)
else:
output =... | 30 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_timeout_read_timing.py | test_read_traceroute_no_response_full | assert | numeric_literal | 29 | from datetime import datetime
def execute_cmd(conn, cmd="show tech-support", read_timeout=None, last_read=2.0):
start_time = datetime.now()
cmd = cmd.strip()
conn.write_channel(cmd + "\n")
if read_timeout is None:
output = conn.read_channel_timing(last_read=last_read)
else:
output =... | 90 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_timeout_read_timing.py | test_read_traceroute_no_response_full | assert | numeric_literal | 30 | from datetime import datetime
def execute_cmd(conn, cmd="show tech-support", read_timeout=None, last_read=2.0):
start_time = datetime.now()
cmd = cmd.strip()
conn.write_channel(cmd + "\n")
if read_timeout is None:
output = conn.read_channel_timing(last_read=last_read)
else:
output =... | 100 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_timeout_read_timing.py | test_read_show_tech | assert | variable | 24 | from datetime import datetime
def execute_cmd(conn, cmd="show tech-support", read_timeout=None, last_read=2.0):
start_time = datetime.now()
cmd = cmd.strip()
conn.write_channel(cmd + "\n")
if read_timeout is None:
output = conn.read_channel_timing(last_read=last_read)
else:
output =... | output | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_timeout_read_until_pattern.py | test_read_longrunning_cmd | assert | numeric_literal | 56 | from datetime import datetime
import pytest
import time
import re
from netmiko import ReadTimeout
def execute_cmd(conn, pattern, read_timeout, cmd="show tech-support\n", max_loops=None):
conn.write_channel("show tech-support\n")
return conn.read_until_pattern(
pattern=pattern, read_timeout=read_timeout... | 10 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_timeout_read_until_pattern.py | test_read_longrunning_cmd | assert | variable | 55 | from datetime import datetime
import pytest
import time
import re
from netmiko import ReadTimeout
def execute_cmd(conn, pattern, read_timeout, cmd="show tech-support\n", max_loops=None):
conn.write_channel("show tech-support\n")
return conn.read_until_pattern(
pattern=pattern, read_timeout=read_timeout... | output | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_timeout_read_until_pattern.py | test_read_timeout | assert | variable | 71 | from datetime import datetime
import pytest
import time
import re
from netmiko import ReadTimeout
def execute_cmd(conn, pattern, read_timeout, cmd="show tech-support\n", max_loops=None):
conn.write_channel("show tech-support\n")
return conn.read_until_pattern(
pattern=pattern, read_timeout=read_timeout... | allowed_percentage | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_timeout_send_command.py | test_read_longrunning_cmd | assert | numeric_literal | 56 | from datetime import datetime
import pytest
import time
import re
from netmiko import ReadTimeout
CLEANUP = False
def my_cleanup(conn, sleep=180):
try:
# Must be long enough for "show tech-support" to finish
time.sleep(sleep)
conn.disconnect()
except Exception:
# If it fails, j... | 10 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_timeout_send_command.py | test_read_longrunning_cmd | assert | variable | 55 | from datetime import datetime
import pytest
import time
import re
from netmiko import ReadTimeout
CLEANUP = False
def my_cleanup(conn, sleep=180):
try:
# Must be long enough for "show tech-support" to finish
time.sleep(sleep)
conn.disconnect()
except Exception:
# If it fails, j... | output | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/test_timeout_send_command.py | test_read_timeout | assert | variable | 71 | from datetime import datetime
import pytest
import time
import re
from netmiko import ReadTimeout
CLEANUP = False
def my_cleanup(conn, sleep=180):
try:
# Must be long enough for "show tech-support" to finish
time.sleep(sleep)
conn.disconnect()
except Exception:
# If it fails, j... | allowed_percentage | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_base_connection.py | test_use_ssh_file | assert | numeric_literal | 50 | import time
from os.path import dirname, join
from threading import Lock
from netmiko import NetmikoTimeoutException
from netmiko.base_connection import BaseConnection
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
def test_use_ssh_file():
"""Update SSH connection parameters based on the SSH "config" ... | 5 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_base_connection.py | test_select_global_delay_factor | assert | numeric_literal | 14 | import time
from os.path import dirname, join
from threading import Lock
from netmiko import NetmikoTimeoutException
from netmiko.base_connection import BaseConnection
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
def test_select_global_delay_factor():
"""Select the global delay factor"""
connect... | 4 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_base_connection.py | test_select_current_delay_factor | assert | numeric_literal | 14 | import time
from os.path import dirname, join
from threading import Lock
from netmiko import NetmikoTimeoutException
from netmiko.base_connection import BaseConnection
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
def test_select_current_delay_factor():
"""Select the current delay factor"""
conne... | 10 | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_base_connection.py | test_strip_ansi_codes | assert | string_literal | 84 | import time
from os.path import dirname, join
from threading import Lock
from netmiko import NetmikoTimeoutException
from netmiko.base_connection import BaseConnection
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
def lock_unlock_timeout(timeout=0):
"""Try to lock when it is already locked"""
con... | "" | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_base_connection.py | test_strip_ansi_codes | assert | string_literal | 88 | import time
from os.path import dirname, join
from threading import Lock
from netmiko import NetmikoTimeoutException
from netmiko.base_connection import BaseConnection
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
def lock_unlock_timeout(timeout=0):
"""Try to lock when it is already locked"""
con... | "\n" | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_base_connection.py | test_use_ssh_file | assert | variable | 49 | import time
from os.path import dirname, join
from threading import Lock
from netmiko import NetmikoTimeoutException
from netmiko.base_connection import BaseConnection
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
def test_use_ssh_file():
"""Update SSH connection parameters based on the SSH "config" ... | result | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_base_connection.py | test_sanitize_nothing | assert | variable | 38 | import time
from os.path import dirname, join
from threading import Lock
from netmiko import NetmikoTimeoutException
from netmiko.base_connection import BaseConnection
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
def test_sanitize_nothing():
"""Keep command echo, trailing router prompt and ANSI esca... | output | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_base_connection.py | test_strip_no_prompt | assert | variable | 17 | import time
from os.path import dirname, join
from threading import Lock
from netmiko import NetmikoTimeoutException
from netmiko.base_connection import BaseConnection
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
def test_strip_no_prompt():
"""Strip no prompt from the output"""
string = """MyRou... | string | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_base_connection.py | test_strip_command | assert | variable | 38 | import time
from os.path import dirname, join
from threading import Lock
from netmiko import NetmikoTimeoutException
from netmiko.base_connection import BaseConnection
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
def test_strip_command():
"""Strip command string from output"""
output = """show ... | expect | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_base_connection.py | test_use_ssh_file | assert | variable | 53 | import time
from os.path import dirname, join
from threading import Lock
from netmiko import NetmikoTimeoutException
from netmiko.base_connection import BaseConnection
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
def test_use_ssh_file():
"""Update SSH connection parameters based on the SSH "config" ... | expected | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_base_connection.py | test_strip_ansi_codes | assert | string_literal | 90 | import time
from os.path import dirname, join
from threading import Lock
from netmiko import NetmikoTimeoutException
from netmiko.base_connection import BaseConnection
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
def lock_unlock_timeout(timeout=0):
"""Try to lock when it is already locked"""
con... | "\n\n\n" | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_base_connection.py | test_normalize_cmd | assert | string_literal | 15 | import time
from os.path import dirname, join
from threading import Lock
from netmiko import NetmikoTimeoutException
from netmiko.base_connection import BaseConnection
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
def test_normalize_cmd():
"""Normalize CLI commands to have a single trailing newline""... | "show version\n" | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_base_connection.py | test_use_ssh_file | assert | complex_expr | 51 | import time
from os.path import dirname, join
from threading import Lock
from netmiko import NetmikoTimeoutException
from netmiko.base_connection import BaseConnection
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
def test_use_ssh_file():
"""Update SSH connection parameters based on the SSH "config" ... | result["sock"].cmd | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_ssh_autodetect.py | test_ssh_base_mapper_order | assert | string_literal | 6 | from netmiko.ssh_autodetect import SSH_MAPPER_BASE
def test_ssh_base_mapper_order():
"SSH_MAPPER_BASE should be sorted based on the most common command used." ""
assert SSH_MAPPER_BASE[0][1]["cmd"] == | "show version" | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_utilities.py | test_find_netmiko_dir | assert | variable | 19 | import os
import sys
from os.path import dirname, join, relpath
import pytest
from netmiko import utilities
from netmiko._textfsm import _clitable as clitable
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
RELATIVE_RESOURCE_FOLDER = join(dirname(dirname(relpath(__file__))), "etc")
CONFIG_FILENAME = join(RE... | folder | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_utilities.py | test_bytes_to_bytes | assert | variable | 17 | import os
import sys
from os.path import dirname, join, relpath
import pytest
from netmiko import utilities
from netmiko._textfsm import _clitable as clitable
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
RELATIVE_RESOURCE_FOLDER = join(dirname(dirname(relpath(__file__))), "etc")
CONFIG_FILENAME = join(RE... | result | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_utilities.py | test_string_to_bytes | assert | string_literal | 16 | import os
import sys
from os.path import dirname, join, relpath
import pytest
from netmiko import utilities
from netmiko._textfsm import _clitable as clitable
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
RELATIVE_RESOURCE_FOLDER = join(dirname(dirname(relpath(__file__))), "etc")
CONFIG_FILENAME = join(RE... | b"test" | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_utilities.py | test_load_yaml_file | assert | variable | 22 | import os
import sys
from os.path import dirname, join, relpath
import pytest
from netmiko import utilities
from netmiko._textfsm import _clitable as clitable
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
RELATIVE_RESOURCE_FOLDER = join(dirname(dirname(relpath(__file__))), "etc")
CONFIG_FILENAME = join(RE... | expected | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_utilities.py | test_textfsm_failed_parsing | assert | variable | 23 | import os
import sys
from os.path import dirname, join, relpath
import pytest
from netmiko import utilities
from netmiko._textfsm import _clitable as clitable
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
RELATIVE_RESOURCE_FOLDER = join(dirname(dirname(relpath(__file__))), "etc")
CONFIG_FILENAME = join(RE... | raw_output | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_utilities.py | test_ntc_templates_discovery | pytest.raises | variable | 47 | import os
import sys
from os.path import dirname, join, relpath
import pytest
from netmiko import utilities
from netmiko._textfsm import _clitable as clitable
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
RELATIVE_RESOURCE_FOLDER = join(dirname(dirname(relpath(__file__))), "etc")
CONFIG_FILENAME = join(RE... | ValueError) | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_utilities.py | test_find_cfg_file | assert | variable | 26 | import os
import sys
from os.path import dirname, join, relpath
import pytest
from netmiko import utilities
from netmiko._textfsm import _clitable as clitable
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
RELATIVE_RESOURCE_FOLDER = join(dirname(dirname(relpath(__file__))), "etc")
CONFIG_FILENAME = join(RE... | CONFIG_FILENAME | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_utilities.py | test_ntc_templates_discovery | assert | variable | 29 | import os
import sys
from os.path import dirname, join, relpath
import pytest
from netmiko import utilities
from netmiko._textfsm import _clitable as clitable
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
RELATIVE_RESOURCE_FOLDER = join(dirname(dirname(relpath(__file__))), "etc")
CONFIG_FILENAME = join(RE... | RESOURCE_FOLDER | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_utilities.py | test_find_cfg_file | assert | string_literal | 41 | import os
import sys
from os.path import dirname, join, relpath
import pytest
from netmiko import utilities
from netmiko._textfsm import _clitable as clitable
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
RELATIVE_RESOURCE_FOLDER = join(dirname(dirname(relpath(__file__))), "etc")
CONFIG_FILENAME = join(RE... | "./.netmiko.yml" | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_utilities.py | test_get_structured_data_genie | assert | string_literal | 91 | import os
import sys
from os.path import dirname, join, relpath
import pytest
from netmiko import utilities
from netmiko._textfsm import _clitable as clitable
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
RELATIVE_RESOURCE_FOLDER = join(dirname(dirname(relpath(__file__))), "etc")
CONFIG_FILENAME = join(RE... | "WS-C3560CX-8PC-S" | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
ktbyers/netmiko | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | train | train | tests/unit/test_utilities.py | test_clitable_to_dict | assert | collection | 26 | import os
import sys
from os.path import dirname, join, relpath
import pytest
from netmiko import utilities
from netmiko._textfsm import _clitable as clitable
RESOURCE_FOLDER = join(dirname(dirname(__file__)), "etc")
RELATIVE_RESOURCE_FOLDER = join(dirname(dirname(relpath(__file__))), "etc")
CONFIG_FILENAME = join(RE... | [{"model": "4500"}] | a71d5155d9930a3618ff22321da3eaafa87673d1 | 111 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_cli_click.py | test_run_app | assert | numeric_literal | 17 | import os
from unittest.mock import MagicMock, patch
from click.testing import CliRunner
from flameshow.main import ensure_tty, main
@patch("flameshow.main.os")
def test_run_app(mock_os, data_dir):
mock_os.isatty.return_value = True
runner = CliRunner()
result = runner.invoke(
main, [str(data_dir... | 0 | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_cli_click.py | test_ensure_tty_when_its_not | assert | variable | 23 | import os
from unittest.mock import MagicMock, patch
from click.testing import CliRunner
from flameshow.main import ensure_tty, main
@patch("flameshow.main.sys")
@patch("flameshow.main.os")
def test_ensure_tty_when_its_not(mock_os, mock_sys):
mock_os.isatty.return_value = False
opened_fd = object()
mock_... | opened_fd | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_cli_click.py | test_print_version | assert | string_literal | 14 | import os
from unittest.mock import MagicMock, patch
from click.testing import CliRunner
from flameshow.main import ensure_tty, main
def test_print_version():
runner = CliRunner()
with patch("flameshow.main.__version__", "1.2.3"):
result = runner.invoke(main, ["--version"])
assert result.exit... | "1.2.3\n" | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_colors.py | test_linaer_color_platte | assert | variable | 12 | from flameshow.colors import LinaerColorPlatte, flamegraph_random_color_platte
from textual.color import Color
def test_linaer_color_platte():
platte = LinaerColorPlatte()
color1 = platte.get_color("1")
color3 = platte.get_color("1")
color2 = platte.get_color("2")
assert color1 is | color3 | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_integration/test_app.py | test_app_startup | assert | numeric_literal | 16 | from flameshow.render.app import FlameshowApp
async def test_app_startup(profile10s_profile):
app = FlameshowApp(profile10s_profile)
async with app.run_test() as pilot:
center_text = app.query_one("HeaderOpenedFilename")
assert (
center_text.filename
== "pprof_data/profi... | 34 | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_integration/test_app.py | test_app_startup | assert | string_literal | 17 | from flameshow.render.app import FlameshowApp
async def test_app_startup(profile10s_profile):
app = FlameshowApp(profile10s_profile)
async with app.run_test() as pilot:
center_text = app.query_one("HeaderOpenedFilename")
assert (
center_text.filename
== "pprof_data/profi... | "runtime.mcall" | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_integration/test_app.py | test_app_startup | assert | string_literal | 8 | from flameshow.render.app import FlameshowApp
async def test_app_startup(profile10s_profile):
app = FlameshowApp(profile10s_profile)
async with app.run_test() as pilot:
center_text = app.query_one("HeaderOpenedFilename")
assert | "pprof_data/profile-10seconds.out: (cpu, nanoseconds)" | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_models.py | test_parse_max_depth_when_have_multiple_lines | assert | numeric_literal | 11 | from unittest.mock import patch
from flameshow.models import Profile, SampleType
from flameshow.pprof_parser.parser import Frame, ProfileParser
def test_parse_max_depth_when_have_multiple_lines(profile10s):
parser = ProfileParser("abc")
profile = parser.parse(profile10s)
assert profile.highest_lines == | 26 | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_models.py | test_frame | assert | variable | 11 | from unittest.mock import patch
from flameshow.models import Profile, SampleType
from flameshow.pprof_parser.parser import Frame, ProfileParser
def test_frame():
f1 = Frame("foo", 12)
f2 = Frame("bar", 12)
assert f1 == | f2 | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_models.py | test_pile_up | assert | collection | 20 | from unittest.mock import patch
from flameshow.models import Profile, SampleType
from flameshow.pprof_parser.parser import Frame, ProfileParser
def test_pile_up():
root = Frame("root", 0, values=[5])
s1 = Frame("s1", 1, values=[4], parent=root)
s2 = Frame("s2", 2, values=[4], parent=s1)
root.children... | [7] | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_models.py | test_pile_up | assert | collection | 21 | from unittest.mock import patch
from flameshow.models import Profile, SampleType
from flameshow.pprof_parser.parser import Frame, ProfileParser
def test_pile_up():
root = Frame("root", 0, values=[5])
s1 = Frame("s1", 1, values=[4], parent=root)
s2 = Frame("s2", 2, values=[4], parent=s1)
root.children... | [6] | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_models.py | test_frame | assert | numeric_literal | 13 | from unittest.mock import patch
from flameshow.models import Profile, SampleType
from flameshow.pprof_parser.parser import Frame, ProfileParser
def test_frame():
f1 = Frame("foo", 12)
f2 = Frame("bar", 12)
assert f1 == f2
assert f1 != Frame("a", 13)
assert f1 != | 123 | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_models.py | test_frame | assert | collection | 16 | from unittest.mock import patch
from flameshow.models import Profile, SampleType
from flameshow.pprof_parser.parser import Frame, ProfileParser
def test_frame():
f1 = Frame("foo", 12)
f2 = Frame("bar", 12)
assert f1 == f2
assert f1 != Frame("a", 13)
assert f1 != 123
f4 = Frame("has_child", 1... | [f1] | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_models.py | test_frame_get_color | assert_* | string_literal | 12 | from unittest.mock import patch
from flameshow.models import Profile, SampleType
from flameshow.pprof_parser.parser import Frame, ProfileParser
def test_frame_get_color():
with patch("flameshow.models.r") as mock_r:
mock_r.get_color.return_value = "#1122ff"
f1 = Frame("foo", 12)
assert f1.... | "foo") | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_models.py | test_frame_get_color | assert | string_literal | 11 | from unittest.mock import patch
from flameshow.models import Profile, SampleType
from flameshow.pprof_parser.parser import Frame, ProfileParser
def test_frame_get_color():
with patch("flameshow.models.r") as mock_r:
mock_r.get_color.return_value = "#1122ff"
f1 = Frame("foo", 12)
assert f1... | "#1122ff" | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_models.py | test_frame_get_color_full_model_path | assert_* | string_literal | 14 | from unittest.mock import patch
from flameshow.models import Profile, SampleType
from flameshow.pprof_parser.parser import Frame, ProfileParser
def test_frame_get_color_full_model_path():
with patch("flameshow.models.r") as mock_r:
mock_r.get_color.return_value = "#1122ff"
f1 = Frame(
... | "expfmt") | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_models.py | test_frame | assert | func_call | 12 | from unittest.mock import patch
from flameshow.models import Profile, SampleType
from flameshow.pprof_parser.parser import Frame, ProfileParser
def test_frame():
f1 = Frame("foo", 12)
f2 = Frame("bar", 12)
assert f1 == f2
assert f1 != | Frame("a", 13) | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_models.py | test_frame | assert | string_literal | 18 | from unittest.mock import patch
from flameshow.models import Profile, SampleType
from flameshow.pprof_parser.parser import Frame, ProfileParser
def test_frame():
f1 = Frame("foo", 12)
f2 = Frame("bar", 12)
assert f1 == f2
assert f1 != Frame("a", 13)
assert f1 != 123
f4 = Frame("has_child", 1... | "<Frame #12 foo>" | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_models.py | test_profile_creataion | assert | collection | 29 | from unittest.mock import patch
from flameshow.models import Profile, SampleType
from flameshow.pprof_parser.parser import Frame, ProfileParser
def test_profile_creataion():
root = Frame("root", 0, values=[5])
s1 = Frame("s1", 1, values=[4], parent=root)
s2 = Frame("s2", 2, values=[1], parent=s1)
s3 =... | [[root], [s1], [s2, s3]] | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_pprof_parse/test_golang_pprof.py | test_golang_goroutine_parse_using_protobuf | assert | numeric_literal | 22 | import datetime
import json
from flameshow.models import Frame, Profile, SampleType
from flameshow.pprof_parser.parser import ProfileParser
from flameshow.pprof_parser.parser import (
Function,
Line,
Location,
Mapping,
ProfileParser,
get_frame_tree,
parse_profile,
unmarshal,
)
from ..u... | 1 | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_pprof_parse/test_golang_pprof.py | test_golang_profile10s_parse_using_protobuf | assert | numeric_literal | 22 | import datetime
import json
from flameshow.models import Frame, Profile, SampleType
from flameshow.pprof_parser.parser import ProfileParser
from flameshow.pprof_parser.parser import (
Function,
Line,
Location,
Mapping,
ProfileParser,
get_frame_tree,
parse_profile,
unmarshal,
)
from ..u... | 2 | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_pprof_parse/test_golang_pprof.py | test_golang_goroutine_parse_using_protobuf | assert | numeric_literal | 35 | import datetime
import json
from flameshow.models import Frame, Profile, SampleType
from flameshow.pprof_parser.parser import ProfileParser
from flameshow.pprof_parser.parser import (
Function,
Line,
Location,
Mapping,
ProfileParser,
get_frame_tree,
parse_profile,
unmarshal,
)
from ..u... | -1 | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_pprof_parse/test_golang_pprof.py | test_golang_goroutine_parse_using_protobuf | assert | numeric_literal | 36 | import datetime
import json
from flameshow.models import Frame, Profile, SampleType
from flameshow.pprof_parser.parser import ProfileParser
from flameshow.pprof_parser.parser import (
Function,
Line,
Location,
Mapping,
ProfileParser,
get_frame_tree,
parse_profile,
unmarshal,
)
from ..u... | 24 | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_pprof_parse/test_golang_pprof.py | test_golang_profile10s_parse_using_protobuf | assert | string_literal | 28 | import datetime
import json
from flameshow.models import Frame, Profile, SampleType
from flameshow.pprof_parser.parser import ProfileParser
from flameshow.pprof_parser.parser import (
Function,
Line,
Location,
Mapping,
ProfileParser,
get_frame_tree,
parse_profile,
unmarshal,
)
from ..u... | "cpu" | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_pprof_parse/test_golang_pprof.py | test_golang_goroutine_parse_using_protobuf | assert | string_literal | 26 | import datetime
import json
from flameshow.models import Frame, Profile, SampleType
from flameshow.pprof_parser.parser import ProfileParser
from flameshow.pprof_parser.parser import (
Function,
Line,
Location,
Mapping,
ProfileParser,
get_frame_tree,
parse_profile,
unmarshal,
)
from ..u... | "count" | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_pprof_parse/test_golang_pprof.py | test_python_protobuf_goroutine_check_frame_tree | assert | variable | 27 | import datetime
import json
from flameshow.models import Frame, Profile, SampleType
from flameshow.pprof_parser.parser import ProfileParser
from flameshow.pprof_parser.parser import (
Function,
Line,
Location,
Mapping,
ProfileParser,
get_frame_tree,
parse_profile,
unmarshal,
)
from ..u... | expected | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_pprof_parse/test_golang_pprof.py | test_parser_get_name_aggr | assert | collection | 40 | import datetime
import json
from flameshow.models import Frame, Profile, SampleType
from flameshow.pprof_parser.parser import ProfileParser
from flameshow.pprof_parser.parser import (
Function,
Line,
Location,
Mapping,
ProfileParser,
get_frame_tree,
parse_profile,
unmarshal,
)
from ..u... | [Frame("", 0)] | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
laixintao/flameshow | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | train | train | tests/test_pprof_parse/test_golang_pprof.py | test_parser_get_name_aggr | assert | collection | 41 | import datetime
import json
from flameshow.models import Frame, Profile, SampleType
from flameshow.pprof_parser.parser import ProfileParser
from flameshow.pprof_parser.parser import (
Function,
Line,
Location,
Mapping,
ProfileParser,
get_frame_tree,
parse_profile,
unmarshal,
)
from ..u... | [Frame("", 1)] | 0c22a39da05c34bcdcaf90fae6554dfab2ad7b77 | 19 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.