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
nonebot/nonebot2
from collections.abc import Callable from dataclasses import asdict from functools import wraps from pathlib import Path import sys from typing import TypeVar from typing_extensions import ParamSpec import pytest import nonebot from nonebot.plugin import ( Plugin, PluginManager, _managers, _plugins, ...
{sub_plugin, sub_plugin2}
assert
collection
tests/test_plugin/test_load.py
test_load_nested_plugin
84
null
nonebot/nonebot2
from http.cookies import SimpleCookie import json from typing import Any from aiohttp import ClientSession, ClientWebSocketResponse, WSMessage, WSMsgType import anyio from nonebug import App import pytest from nonebot.adapters import Bot from nonebot.dependencies import Dependent from nonebot.drivers import ( URL...
None
assert
none_literal
tests/test_driver.py
background_task
184
null
nonebot/nonebot2
import json from typing import ClassVar, Dict, List, Literal, TypeVar, Union # noqa: UP035 from nonebot.utils import ( DataclassEncoder, escape_tag, generic_check_issubclass, is_async_gen_callable, is_coroutine_callable, is_gen_callable, ) from utils import FakeMessage, FakeMessageSegment def...
"{" '"type": "node", ' '"data": {"content": [{"type": "text", "data": {"text": "text"}}]}' "}"
assert
string_literal
tests/test_utils.py
test_dataclass_encoder
119
null
nonebot/nonebot2
from collections.abc import Callable import pytest import nonebot from nonebot.adapters import Event from nonebot.matcher import Matcher, matchers from nonebot.rule import ( CommandRule, EndswithRule, FullmatchRule, IsTypeRule, KeywordsRule, RegexRule, ShellCommandRule, StartswithRule,...
"plugin"
assert
string_literal
tests/test_plugin/test_on.py
test_runtime_on
165
null
nonebot/nonebot2
import pytest from nonebot.adapters import MessageTemplate from utils import FakeMessage, FakeMessageSegment, escape_text def test_template_message(): template = FakeMessage.template("{a:custom}{b:text}{c:image}/{d}") @template.add_format_spec def custom(input: str) -> str: return f"{input}-custo...
"custom-custom!text/114"
assert
string_literal
tests/test_adapters/test_template.py
test_template_message
32
null
nonebot/nonebot2
from typing import TYPE_CHECKING from pydantic import BaseModel, Field import pytest from nonebot.compat import PYDANTIC_V2, LegacyUnionField from nonebot.config import DOTENV_TYPE, BaseSettings, SettingsConfig, SettingsError def test_config_without_delimiter(): config = ExampleWithoutDelimiter() assert conf...
0
assert
numeric_literal
tests/test_config.py
test_config_without_delimiter
120
null
nonebot/nonebot2
from pydantic import ValidationError import pytest from nonebot.adapters import Message, MessageSegment from nonebot.compat import type_validate_python from utils import FakeMessage, FakeMessageSegment def test_message_contains(): message = FakeMessage( [ FakeMessageSegment.text("test"), ...
False
assert
bool_literal
tests/test_adapters/test_message.py
test_message_contains
190
null
nonebot/nonebot2
from collections.abc import Callable from dataclasses import asdict from functools import wraps from pathlib import Path import sys from typing import TypeVar from typing_extensions import ParamSpec import pytest import nonebot from nonebot.plugin import ( Plugin, PluginManager, _managers, _plugins, ...
num_managers + 1
assert
complex_expr
tests/test_plugin/test_load.py
test_require_not_declared
160
null
nonebot/nonebot2
from dataclasses import dataclass from typing import Annotated, Any from pydantic import BaseModel, ValidationError import pytest from nonebot.compat import ( DEFAULT_CONFIG, FieldInfo, PydanticUndefined, Required, TypeAdapter, custom_validation, field_validator, model_dump, model_...
1
assert
numeric_literal
tests/test_compat.py
test_field_validator
54
null
fudan-zvg/SETR
import torch from mmseg.models import FPN def test_fpn(): in_channels = [256, 512, 1024, 2048] inputs = [ torch.randn(1, c, 56 // 2**i, 56 // 2**i) for i, c in enumerate(in_channels) ] fpn = FPN(in_channels, 256, len(in_channels)) outputs = fpn(inputs) assert outputs[0].shape ...
torch.Size([1, 256, 28, 28])
assert
func_call
tests/test_models/test_necks.py
test_fpn
16
null
fudan-zvg/SETR
import glob import os from os.path import dirname, exists, isdir, join, relpath from mmcv import Config from torch import nn from mmseg.models import build_segmentor def _get_config_directory(): """Find the predefined segmentor config directory.""" try: # Assume we are running in the source mmsegment...
len(decode_head)
assert
func_call
tests/test_config.py
_check_decode_head
135
null
fudan-zvg/SETR
import numpy as np from mmseg.core.evaluation import mean_iou def get_confusion_matrix(pred_label, label, num_classes, ignore_index): """Intersection over Union Args: pred_label (np.ndarray): 2D predict map label (np.ndarray): label 2D label map num_classes (int): number of...
num_imgs
assert
variable
tests/test_mean_iou.py
legacy_mean_iou
30
null
fudan-zvg/SETR
import numpy as np import pytest import torch from mmseg.models.losses import Accuracy, reduce_loss, weight_reduce_loss def test_utils(): loss = torch.rand(1, 3, 4, 4) weight = torch.zeros(1, 3, 4, 4) weight[:, :, :2, :2] = 1 # test reduce_loss() reduced = reduce_loss(loss, 'none') assert re...
loss
assert
variable
tests/test_models/test_losses.py
test_utils
15
null
fudan-zvg/SETR
import os.path as osp from unittest.mock import MagicMock, patch import numpy as np import pytest from mmseg.core.evaluation import get_classes, get_palette from mmseg.datasets import (DATASETS, ADE20KDataset, CityscapesDataset, ConcatDataset, CustomDataset, PascalVOCDataset, ...
classes
assert
variable
tests/test_data/test_dataset.py
test_custom_classes_override_default
201
null
fudan-zvg/SETR
import glob import os from os.path import dirname, exists, isdir, join, relpath from mmcv import Config from torch import nn from mmseg.models import build_segmentor def _get_config_directory(): """Find the predefined segmentor config directory.""" try: # Assume we are running in the source mmsegment...
len(decode_head.in_index)
assert
func_call
tests/test_config.py
_check_decode_head
151
null
fudan-zvg/SETR
from unittest.mock import patch import pytest import torch from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule from mmcv.utils import ConfigDict from mmcv.utils.parrots_wrapper import SyncBatchNorm from mmseg.models.decode_heads import (ANNHead, ASPPHead, CCHead, DAHead, ...
2
assert
numeric_literal
tests/test_models/test_heads.py
test_fcn_head
133
null
fudan-zvg/SETR
from unittest.mock import patch import pytest import torch from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule from mmcv.utils import ConfigDict from mmcv.utils.parrots_wrapper import SyncBatchNorm from mmseg.models.decode_heads import (ANNHead, ASPPHead, CCHead, DAHead, ...
0
assert
numeric_literal
tests/test_models/test_heads.py
test_fcn_head
168
null
fudan-zvg/SETR
import numpy as np from mmseg.core.evaluation import mean_iou def get_confusion_matrix(pred_label, label, num_classes, ignore_index): """Intersection over Union Args: pred_label (np.ndarray): 2D predict map label (np.ndarray): label 2D label map num_classes (int): number of...
all_acc_l
assert
variable
tests/test_mean_iou.py
test_mean_iou
54
null
fudan-zvg/SETR
import numpy as np import pytest import torch from mmseg.models.losses import Accuracy, reduce_loss, weight_reduce_loss def test_accuracy(): # test for empty pred pred = torch.empty(0, 4) label = torch.empty(0) accuracy = Accuracy(topk=1) acc = accuracy(pred, label) assert acc.item() == 0 ...
40
assert
numeric_literal
tests/test_models/test_losses.py
test_accuracy
100
null
fudan-zvg/SETR
import os.path as osp from unittest.mock import MagicMock, patch import numpy as np import pytest from mmseg.core.evaluation import get_classes, get_palette from mmseg.datasets import (DATASETS, ADE20KDataset, CityscapesDataset, ConcatDataset, CustomDataset, PascalVOCDataset, ...
list(classes)
assert
func_call
tests/test_data/test_dataset.py
test_custom_classes_override_default
212
null
fudan-zvg/SETR
import os.path as osp from unittest.mock import MagicMock, patch import numpy as np import pytest from mmseg.core.evaluation import get_classes, get_palette from mmseg.datasets import (DATASETS, ADE20KDataset, CityscapesDataset, ConcatDataset, CustomDataset, PascalVOCDataset, ...
2
assert
numeric_literal
tests/test_data/test_dataset.py
test_custom_dataset_random_palette_is_generated
246
null
fudan-zvg/SETR
import math import os.path as osp import pytest from torch.utils.data import (DistributedSampler, RandomSampler, SequentialSampler) from mmseg.datasets import (DATASETS, ConcatDataset, build_dataloader, build_dataset) def test_build_dataloader(): dataset ...
16
assert
numeric_literal
tests/test_data/test_dataset_builder.py
test_build_dataloader
192
null
fudan-zvg/SETR
import pytest import torch from mmseg.models.utils import InvertedResidual def test_inv_residual(): with pytest.raises(AssertionError): # test stride assertion. InvertedResidual(32, 32, 3, 4) # test default config with res connection. # set expand_ratio = 4, stride = 1 and inp=oup. in...
0
assert
numeric_literal
tests/test_utils/test_inverted_residual_module.py
test_inv_residual
17
null
fudan-zvg/SETR
import copy import os.path as osp import mmcv import numpy as np import pytest from mmcv.utils import build_from_cfg from PIL import Image from mmseg.datasets.builder import PIPELINES def test_resize(): # test assertion if img_scale is a list with pytest.raises(AssertionError): transform = dict(type=...
1333 * 1.1
assert
complex_expr
tests/test_data/test_transform.py
test_resize
93
null
fudan-zvg/SETR
import torch from mmseg.models import FPN def test_fpn(): in_channels = [256, 512, 1024, 2048] inputs = [ torch.randn(1, c, 56 // 2**i, 56 // 2**i) for i, c in enumerate(in_channels) ] fpn = FPN(in_channels, 256, len(in_channels)) outputs = fpn(inputs) assert outputs[0].shape...
torch.Size([1, 256, 56, 56])
assert
func_call
tests/test_models/test_necks.py
test_fpn
15
null
fudan-zvg/SETR
import os.path as osp from unittest.mock import MagicMock, patch import numpy as np import pytest from mmseg.core.evaluation import get_classes, get_palette from mmseg.datasets import (DATASETS, ADE20KDataset, CityscapesDataset, ConcatDataset, CustomDataset, PascalVOCDataset, ...
original_classes
assert
variable
tests/test_data/test_dataset.py
test_custom_classes_override_default
200
null
fudan-zvg/SETR
from unittest.mock import patch import pytest import torch from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule from mmcv.utils import ConfigDict from mmcv.utils.parrots_wrapper import SyncBatchNorm from mmseg.models.decode_heads import (ANNHead, ASPPHead, CCHead, DAHead, ...
1
assert
numeric_literal
tests/test_models/test_heads.py
test_fcn_head
177
null
fudan-zvg/SETR
import glob import os from os.path import dirname, exists, isdir, join, relpath from mmcv import Config from torch import nn from mmseg.models import build_segmentor def _get_config_directory(): """Find the predefined segmentor config directory.""" try: # Assume we are running in the source mmsegment...
decode_head.in_channels
assert
complex_expr
tests/test_config.py
_check_decode_head
153
null
fudan-zvg/SETR
import logging import tempfile from unittest.mock import MagicMock, patch import mmcv.runner import pytest import torch import torch.nn as nn from mmcv.runner import obj_from_dict from torch.utils.data import DataLoader, Dataset from mmseg.apis import single_gpu_test from mmseg.core import DistEvalHook, EvalHook def...
[torch.tensor([1])])
assert_*
collection
tests/test_eval_hook.py
test_eval_hook
74
null
fudan-zvg/SETR
import copy import os.path as osp import mmcv import numpy as np import pytest from mmcv.utils import build_from_cfg from PIL import Image from mmseg.datasets.builder import PIPELINES def test_seg_rescale(): results = dict() seg = np.array( Image.open(osp.join(osp.dirname(__file__), '../data/seg.png'...
(h // 2, w // 2)
assert
collection
tests/test_data/test_transform.py
test_seg_rescale
237
null
fudan-zvg/SETR
import pytest import torch from mmcv.ops import DeformConv2dPack from mmcv.utils.parrots_wrapper import _BatchNorm from torch.nn.modules import AvgPool2d, GroupNorm from mmseg.models.backbones import (FastSCNN, ResNeSt, ResNet, ResNetV1d, ResNeXt) from mmseg.models.backbones.resnest...
16
assert
numeric_literal
tests/test_models/test_backbone.py
test_resnet_bottleneck
183
null
fudan-zvg/SETR
import torch from mmseg.models import FPN def test_fpn(): in_channels = [256, 512, 1024, 2048] inputs = [ torch.randn(1, c, 56 // 2**i, 56 // 2**i) for i, c in enumerate(in_channels) ] fpn = FPN(in_channels, 256, len(in_channels)) outputs = fpn(inputs) assert outputs[0].shape ...
torch.Size([1, 256, 14, 14])
assert
func_call
tests/test_models/test_necks.py
test_fpn
17
null
fudan-zvg/SETR
import copy import os.path as osp import mmcv import numpy as np import pytest from mmcv.utils import build_from_cfg from PIL import Image from mmseg.datasets.builder import PIPELINES def test_resize(): # test assertion if img_scale is a list with pytest.raises(AssertionError): transform = dict(type=...
400
assert
numeric_literal
tests/test_data/test_transform.py
test_resize
72
null
fudan-zvg/SETR
import glob import os from os.path import dirname, exists, isdir, join, relpath from mmcv import Config from torch import nn from mmseg.models import build_segmentor def _get_config_directory(): """Find the predefined segmentor config directory.""" try: # Assume we are running in the source mmsegment...
None
assert
none_literal
tests/test_config.py
test_config_build_segmentor
61
null
fudan-zvg/SETR
from unittest.mock import patch import pytest import torch from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule from mmcv.utils import ConfigDict from mmcv.utils.parrots_wrapper import SyncBatchNorm from mmseg.models.decode_heads import (ANNHead, ASPPHead, CCHead, DAHead, ...
0.05
assert
numeric_literal
tests/test_models/test_heads.py
test_dnl_head
584
null
fudan-zvg/SETR
import numpy as np import pytest import torch from mmseg.models.losses import Accuracy, reduce_loss, weight_reduce_loss def test_utils(): loss = torch.rand(1, 3, 4, 4) weight = torch.zeros(1, 3, 4, 4) weight[:, :, :2, :2] = 1 # test reduce_loss() reduced = reduce_loss(loss, 'none') assert red...
target)
assert_*
variable
tests/test_models/test_losses.py
test_utils
29
null
fudan-zvg/SETR
import pytest import torch from mmcv.ops import DeformConv2dPack from mmcv.utils.parrots_wrapper import _BatchNorm from torch.nn.modules import AvgPool2d, GroupNorm from mmseg.models.backbones import (FastSCNN, ResNeSt, ResNet, ResNetV1d, ResNeXt) from mmseg.models.backbones.resnest...
3
assert
numeric_literal
tests/test_models/test_backbone.py
test_resnet_res_layer
237
null
fudan-zvg/SETR
import copy import os.path as osp import mmcv import numpy as np import pytest from mmcv.utils import build_from_cfg from PIL import Image from mmseg.datasets.builder import PIPELINES def test_random_crop(): # test assertion for invalid random crop with pytest.raises(
AssertionError)
pytest.raises
variable
tests/test_data/test_transform.py
test_random_crop
137
null
fudan-zvg/SETR
import os.path as osp from unittest.mock import MagicMock, patch import numpy as np import pytest from mmseg.core.evaluation import get_classes, get_palette from mmseg.datasets import (DATASETS, ADE20KDataset, CityscapesDataset, ConcatDataset, CustomDataset, PascalVOCDataset, ...
ValueError)
pytest.raises
variable
tests/test_data/test_dataset.py
test_classes
20
null
fudan-zvg/SETR
from unittest.mock import patch import pytest import torch from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule from mmcv.utils import ConfigDict from mmcv.utils.parrots_wrapper import SyncBatchNorm from mmseg.models.decode_heads import (ANNHead, ASPPHead, CCHead, DAHead, ...
48
assert
numeric_literal
tests/test_models/test_heads.py
test_decode_head
99
null
fudan-zvg/SETR
import pytest import torch from mmseg.models.utils import InvertedResidual def test_inv_residual(): with pytest.raises(AssertionError): # test stride assertion. InvertedResidual(32, 32, 3, 4) # test default config with res connection. # set expand_ratio = 4, stride = 1 and inp=oup. in...
1
assert
numeric_literal
tests/test_utils/test_inverted_residual_module.py
test_inv_residual
19
null
fudan-zvg/SETR
import math import os.path as osp import pytest from torch.utils.data import (DistributedSampler, RandomSampler, SequentialSampler) from mmseg.datasets import (DATASETS, ConcatDataset, build_dataloader, build_dataset) def test_build_dataset(): cfg = dict(...
5
assert
numeric_literal
tests/test_data/test_dataset_builder.py
test_build_dataset
60
null
fudan-zvg/SETR
from unittest.mock import patch import pytest import torch from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule from mmcv.utils import ConfigDict from mmcv.utils.parrots_wrapper import SyncBatchNorm from mmseg.models.decode_heads import (ANNHead, ASPPHead, CCHead, DAHead, ...
None
assert
none_literal
tests/test_models/test_heads.py
test_decode_head
86
null
fudan-zvg/SETR
import os.path as osp import pickle import shutil import tempfile import time import mmcv import torch import torch.distributed as dist from mmcv.image import tensor2imgs from mmcv.runner import get_dist_info from mmdet.core import encode_mask_results def single_gpu_test(model, data_loader, ...
len(img_metas)
assert
func_call
hlg-detection/mmdet/apis/test.py
single_gpu_test
39
null
fudan-zvg/SETR
import math import os.path as osp import pytest from torch.utils.data import (DistributedSampler, RandomSampler, SequentialSampler) from mmseg.datasets import (DATASETS, ConcatDataset, build_dataloader, build_dataset) def test_build_dataset(): cfg = dict(...
1
assert
numeric_literal
tests/test_data/test_dataset_builder.py
test_build_dataset
32
null
fudan-zvg/SETR
import torch from mmseg.models import FPN def test_fpn(): in_channels = [256, 512, 1024, 2048] inputs = [ torch.randn(1, c, 56 // 2**i, 56 // 2**i) for i, c in enumerate(in_channels) ] fpn = FPN(in_channels, 256, len(in_channels)) outputs = fpn(inputs) assert outputs[0].shape ...
torch.Size([1, 256, 7, 7])
assert
func_call
tests/test_models/test_necks.py
test_fpn
18
null
fudan-zvg/SETR
import copy import os.path as osp import mmcv import numpy as np import pytest from mmcv.utils import build_from_cfg from PIL import Image from mmseg.datasets.builder import PIPELINES def test_seg_rescale(): results = dict() seg = np.array( Image.open(osp.join(osp.dirname(__file__), '../data/seg.png'...
(h, w)
assert
collection
tests/test_data/test_transform.py
test_seg_rescale
242
null
fudan-zvg/SETR
import numpy as np import pytest import torch from mmseg.models.losses import Accuracy, reduce_loss, weight_reduce_loss def test_utils(): loss = torch.rand(1, 3, 4, 4) weight = torch.zeros(1, 3, 4, 4) weight[:, :, :2, :2] = 1 # test reduce_loss() reduced = reduce_loss(loss, 'none') assert red...
loss.sum())
assert_*
func_call
tests/test_models/test_losses.py
test_utils
21
null
fudan-zvg/SETR
import logging import tempfile from unittest.mock import MagicMock, patch import mmcv.runner import pytest import torch import torch.nn as nn from mmcv.runner import obj_from_dict from torch.utils.data import DataLoader, Dataset from mmseg.apis import single_gpu_test from mmseg.core import DistEvalHook, EvalHook def...
TypeError)
pytest.raises
variable
tests/test_eval_hook.py
test_eval_hook
42
null
fudan-zvg/SETR
import numpy as np import pytest import torch from mmseg.models.losses import Accuracy, reduce_loss, weight_reduce_loss def test_accuracy(): # test for empty pred pred = torch.empty(0, 4) label = torch.empty(0) accuracy = Accuracy(topk=1) acc = accuracy(pred, label) assert acc.item() == 0 ...
100
assert
numeric_literal
tests/test_models/test_losses.py
test_accuracy
94
null
fudan-zvg/SETR
import os.path as osp from unittest.mock import MagicMock, patch import numpy as np import pytest from mmseg.core.evaluation import get_classes, get_palette from mmseg.datasets import (DATASETS, ADE20KDataset, CityscapesDataset, ConcatDataset, CustomDataset, PascalVOCDataset, ...
4
assert
numeric_literal
tests/test_data/test_dataset.py
test_custom_dataset
114
null
fudan-zvg/SETR
import pytest import torch from mmcv.ops import DeformConv2dPack from mmcv.utils.parrots_wrapper import _BatchNorm from torch.nn.modules import AvgPool2d, GroupNorm from mmseg.models.backbones import (FastSCNN, ResNeSt, ResNet, ResNetV1d, ResNeXt) from mmseg.models.backbones.resnest...
9
assert
numeric_literal
tests/test_models/test_backbone.py
test_resnet_backbone
379
null
fudan-zvg/SETR
import numpy as np import pytest import torch from mmseg.models.losses import Accuracy, reduce_loss, weight_reduce_loss def test_ce_loss(): from mmseg.models import build_loss # use_mask and use_sigmoid cannot be true at the same time with pytest.raises(
AssertionError)
pytest.raises
variable
tests/test_models/test_losses.py
test_ce_loss
47
null
fudan-zvg/SETR
import pytest import torch from mmseg.core import OHEMPixelSampler from mmseg.models.decode_heads import FCNHead def _context_for_ohem(): return FCNHead(in_channels=32, channels=16, num_classes=19) def test_ohem_sampler(): with pytest.raises(AssertionError): # seg_logit and seg_label must be of the ...
seg_logit.shape[0]
assert
complex_expr
tests/test_sampler.py
test_ohem_sampler
27
null
fudan-zvg/SETR
from unittest.mock import patch import pytest import torch from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule from mmcv.utils import ConfigDict from mmcv.utils.parrots_wrapper import SyncBatchNorm from mmseg.models.decode_heads import (ANNHead, ASPPHead, CCHead, DAHead, ...
32
assert
numeric_literal
tests/test_models/test_heads.py
test_decode_head
85
null
fudan-zvg/SETR
import numpy as np from mmseg.core.evaluation import mean_iou def get_confusion_matrix(pred_label, label, num_classes, ignore_index): """Intersection over Union Args: pred_label (np.ndarray): 2D predict map label (np.ndarray): label 2D label map num_classes (int): number of...
-1
assert
numeric_literal
tests/test_mean_iou.py
test_mean_iou
62
null
fudan-zvg/SETR
import numpy as np import pytest import torch from mmseg.models.losses import Accuracy, reduce_loss, weight_reduce_loss def test_utils(): loss = torch.rand(1, 3, 4, 4) weight = torch.zeros(1, 3, 4, 4) weight[:, :, :2, :2] = 1 # test reduce_loss() reduced = reduce_loss(loss, 'none') assert red...
loss.mean())
assert_*
func_call
tests/test_models/test_losses.py
test_utils
18
null
fudan-zvg/SETR
import pytest import torch from mmseg.models.utils import InvertedResidual def test_inv_residual(): with pytest.raises(AssertionError): # test stride assertion. InvertedResidual(32, 32, 3, 4) # test default config with res connection. # set expand_ratio = 4, stride = 1 and inp=oup. in...
(1, 1)
assert
collection
tests/test_utils/test_inverted_residual_module.py
test_inv_residual
16
null
fudan-zvg/SETR
import os.path as osp import pickle import shutil import tempfile import mmcv import torch import torch.distributed as dist from mmcv.image import tensor2imgs from mmcv.runner import get_dist_info def single_gpu_test(model, data_loader, show=False, out_dir=None): """Test with single GPU. Args: model ...
len(img_metas)
assert
func_call
mmseg/apis/test.py
single_gpu_test
43
null
fudan-zvg/SETR
import copy import os.path as osp import tempfile import mmcv import numpy as np from mmseg.datasets.pipelines import LoadAnnotations, LoadImageFromFile class TestLoading(object): def setup_class(cls): cls.data_prefix = osp.join(osp.dirname(__file__), '../data') def test_load_img(self): res...
np.uint8
assert
complex_expr
tests/test_data/test_loading.py
test_load_img
TestLoading
25
null
fudan-zvg/SETR
import os.path as osp from unittest.mock import MagicMock, patch import numpy as np import pytest from mmseg.core.evaluation import get_classes, get_palette from mmseg.datasets import (DATASETS, ADE20KDataset, CityscapesDataset, ConcatDataset, CustomDataset, PascalVOCDataset, ...
7
assert
numeric_literal
tests/test_data/test_dataset.py
test_dataset_wrapper
57
null
fudan-zvg/SETR
from unittest.mock import patch import pytest import torch from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule from mmcv.utils import ConfigDict from mmcv.utils.parrots_wrapper import SyncBatchNorm from mmseg.models.decode_heads import (ANNHead, ASPPHead, CCHead, DAHead, ...
3
assert
numeric_literal
tests/test_models/test_heads.py
test_psp_head
207
null
fudan-zvg/SETR
import argparse import copy import os import os.path as osp import mmcv import torch from mmcv import DictAction from mmcv.parallel import MMDataParallel, MMDistributedDataParallel from mmcv.runner import (get_dist_info, init_dist, load_checkpoint, wrap_fp16_model) from pycocotools.coco import...
['proposal', 'bbox', 'segm', 'keypoints']
assert
collection
hlg-detection/tools/analysis_tools/test_robustness.py
coco_eval_with_return
29
null
fudan-zvg/SETR
import os.path as osp from unittest.mock import MagicMock, patch import numpy as np import pytest from mmseg.core.evaluation import get_classes, get_palette from mmseg.datasets import (DATASETS, ADE20KDataset, CityscapesDataset, ConcatDataset, CustomDataset, PascalVOCDataset, ...
15
assert
numeric_literal
tests/test_data/test_dataset.py
test_dataset_wrapper
51
null
fudan-zvg/SETR
import pytest import torch from mmseg.core import OHEMPixelSampler from mmseg.models.decode_heads import FCNHead def _context_for_ohem(): return FCNHead(in_channels=32, channels=16, num_classes=19) def test_ohem_sampler(): with pytest.raises(
AssertionError)
pytest.raises
variable
tests/test_sampler.py
test_ohem_sampler
14
null
fudan-zvg/SETR
import copy import os.path as osp import mmcv import numpy as np import pytest from mmcv.utils import build_from_cfg from PIL import Image from mmseg.datasets.builder import PIPELINES def test_resize(): # test assertion if img_scale is a list with pytest.raises(AssertionError): transform = dict(type=...
1333
assert
numeric_literal
tests/test_data/test_transform.py
test_resize
71
null
fudan-zvg/SETR
import copy import os.path as osp import tempfile import mmcv import numpy as np from mmseg.datasets.pipelines import LoadAnnotations, LoadImageFromFile class TestLoading(object): def setup_class(cls): cls.data_prefix = osp.join(osp.dirname(__file__), '../data') def test_load_img(self): res...
np.float32
assert
complex_expr
tests/test_data/test_loading.py
test_load_img
TestLoading
47
null
fudan-zvg/SETR
from unittest.mock import patch import pytest import torch from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule from mmcv.utils import ConfigDict from mmcv.utils.parrots_wrapper import SyncBatchNorm from mmseg.models.decode_heads import (ANNHead, ASPPHead, CCHead, DAHead, ...
8
assert
numeric_literal
tests/test_models/test_heads.py
test_dw_aspp_head
538
null
fudan-zvg/SETR
import pytest import torch from mmseg.models.utils import InvertedResidual def test_inv_residual(): with pytest.raises(AssertionError): # test stride assertion. InvertedResidual(32, 32, 3, 4) # test default config with res connection. # set expand_ratio = 4, stride = 1 and inp=oup. in...
(3, 3)
assert
collection
tests/test_utils/test_inverted_residual_module.py
test_inv_residual
18
null
fudan-zvg/SETR
import copy import os.path as osp import mmcv import numpy as np import pytest from mmcv.utils import build_from_cfg from PIL import Image from mmseg.datasets.builder import PIPELINES def test_random_crop(): # test assertion for invalid random crop with pytest.raises(AssertionError): transform = dict...
(h - 20, w - 20)
assert
collection
tests/test_data/test_transform.py
test_random_crop
159
null
fudan-zvg/SETR
import copy import os.path as osp import tempfile import mmcv import numpy as np from mmseg.datasets.pipelines import LoadAnnotations, LoadImageFromFile class TestLoading(object): def setup_class(cls): cls.data_prefix = osp.join(osp.dirname(__file__), '../data') def test_load_seg_custom_classes(sel...
(10, 10)
assert
collection
tests/test_data/test_loading.py
test_load_seg_custom_classes
TestLoading
145
null
fudan-zvg/SETR
import os.path as osp from unittest.mock import MagicMock, patch import numpy as np import pytest from mmseg.core.evaluation import get_classes, get_palette from mmseg.datasets import (DATASETS, ADE20KDataset, CityscapesDataset, ConcatDataset, CustomDataset, PascalVOCDataset, ...
3
assert
numeric_literal
tests/test_data/test_dataset.py
test_custom_dataset_random_palette_is_generated
248
null
fudan-zvg/SETR
import os.path as osp from unittest.mock import MagicMock, patch import numpy as np import pytest from mmseg.core.evaluation import get_classes, get_palette from mmseg.datasets import (DATASETS, ADE20KDataset, CityscapesDataset, ConcatDataset, CustomDataset, PascalVOCDataset, ...
[classes[0]]
assert
collection
tests/test_data/test_dataset.py
test_custom_classes_override_default
223
null
ipa-lab/hackingBuddyGPT
import os import unittest from unittest.mock import mock_open, patch from hackingBuddyGPT.usecases.web_api_testing.documentation.parsing.openapi_converter import ( OpenAPISpecificationConverter, ) class TestOpenAPISpecificationConverter(unittest.TestCase): def setUp(self): self.converter = OpenAPISpec...
result)
self.assertIsNone
variable
tests/test_openapi_converter.py
test_convert_file_yaml_to_json_error
TestOpenAPISpecificationConverter
70
null
ipa-lab/hackingBuddyGPT
import unittest from unittest.mock import MagicMock from hackingBuddyGPT.usecases.web_api_testing.response_processing.response_analyzer_with_llm import ResponseAnalyzerWithLLM from hackingBuddyGPT.utils.prompt_generation.information import PromptPurpose class TestResponseAnalyzerWithLLM(unittest.TestCase): def se...
"text/html")
self.assertEqual
string_literal
tests/test_response_analyzer_with_llm.py
test_parse_http_response_html
TestResponseAnalyzerWithLLM
46
null
ipa-lab/hackingBuddyGPT
import os import unittest from unittest.mock import MagicMock from hackingBuddyGPT.usecases.web_api_testing.documentation import OpenAPISpecificationHandler from hackingBuddyGPT.utils.prompt_generation import PromptGenerationHelper from hackingBuddyGPT.utils.prompt_generation.information import PromptStrategy, PromptC...
self.openapi_handler.is_partial_match("/admin", ["/users/{id}", "/posts"]))
self.assertFalse
func_call
tests/test_openAPI_specification_manager.py
test_is_partial_match_false
TestOpenAPISpecificationHandler
168
null
ipa-lab/hackingBuddyGPT
import os import unittest from unittest.mock import MagicMock, patch from hackingBuddyGPT.utils.prompt_generation import PromptGenerationHelper from hackingBuddyGPT.utils.prompt_generation.information import PromptContext from hackingBuddyGPT.usecases.web_api_testing.response_processing.response_handler import ( R...
updated_spec["components"]["schemas"]["Test"]["properties"])
self.assertIn
complex_expr
tests/test_response_handler.py
test_parse_http_response_to_schema
TestResponseHandler
105
null
ipa-lab/hackingBuddyGPT
import unittest from unittest.mock import MagicMock from hackingBuddyGPT.usecases.web_api_testing.response_processing.response_analyzer_with_llm import ResponseAnalyzerWithLLM from hackingBuddyGPT.utils.prompt_generation.information import PromptPurpose class TestResponseAnalyzerWithLLM(unittest.TestCase): def se...
"200")
self.assertEqual
string_literal
tests/test_response_analyzer_with_llm.py
test_parse_http_response_success
TestResponseAnalyzerWithLLM
31
null
ipa-lab/hackingBuddyGPT
import unittest from unittest.mock import MagicMock from hackingBuddyGPT.usecases.web_api_testing.response_processing.response_analyzer_with_llm import ResponseAnalyzerWithLLM from hackingBuddyGPT.utils.prompt_generation.information import PromptPurpose class TestResponseAnalyzerWithLLM(unittest.TestCase): def se...
full_response)
self.assertIn
variable
tests/test_response_analyzer_with_llm.py
test_get_addition_context
TestResponseAnalyzerWithLLM
82
null
ipa-lab/hackingBuddyGPT
import os import unittest from unittest.mock import MagicMock from hackingBuddyGPT.usecases.web_api_testing.documentation import OpenAPISpecificationHandler from hackingBuddyGPT.utils.prompt_generation import PromptGenerationHelper from hackingBuddyGPT.utils.prompt_generation.information import PromptStrategy, PromptC...
"200")
self.assertEqual
string_literal
tests/test_openAPI_specification_manager.py
test_extract_status_code_and_message_valid
TestOpenAPISpecificationHandler
122
null
ipa-lab/hackingBuddyGPT
import os import unittest from unittest.mock import MagicMock, patch from hackingBuddyGPT.utils.logging import LocalLogger from hackingBuddyGPT.usecases.web_api_testing.simple_openapi_documentation import ( SimpleWebAPIDocumentation, SimpleWebAPIDocumentationUseCase, ) from hackingBuddyGPT.utils import Console...
self.agent._prompt_history[0]["content"])
self.assertIn
complex_expr
tests/test_web_api_documentation.py
test_initial_prompt
TestSimpleWebAPIDocumentationTest
41
null
ipa-lab/hackingBuddyGPT
import unittest from unittest.mock import MagicMock from hackingBuddyGPT.usecases.web_api_testing.response_processing.response_analyzer_with_llm import ResponseAnalyzerWithLLM from hackingBuddyGPT.utils.prompt_generation.information import PromptPurpose class TestResponseAnalyzerWithLLM(unittest.TestCase): def se...
additional_context)
self.assertIn
variable
tests/test_response_analyzer_with_llm.py
test_get_addition_context
TestResponseAnalyzerWithLLM
81
null
ipa-lab/hackingBuddyGPT
import os import unittest from unittest.mock import MagicMock, patch from hackingBuddyGPT.utils.prompt_generation import PromptGenerationHelper from hackingBuddyGPT.utils.prompt_generation.information import PromptContext from hackingBuddyGPT.usecases.web_api_testing.response_processing.response_handler import ( R...
{"type": "str", "example": "test"})
self.assertEqual
collection
tests/test_response_handler.py
test_extract_keys
TestResponseHandler
131
null
ipa-lab/hackingBuddyGPT
import os import unittest from unittest.mock import mock_open, patch from hackingBuddyGPT.usecases.web_api_testing.documentation.parsing.openapi_converter import ( OpenAPISpecificationConverter, ) class TestOpenAPISpecificationConverter(unittest.TestCase): def setUp(self): self.converter = OpenAPISpec...
"r")
assert_*
string_literal
tests/test_openapi_converter.py
test_convert_file_yaml_to_json
TestOpenAPISpecificationConverter
27
null
ipa-lab/hackingBuddyGPT
import os import unittest from unittest.mock import MagicMock from hackingBuddyGPT.usecases.web_api_testing.documentation import OpenAPISpecificationHandler from hackingBuddyGPT.utils.prompt_generation import PromptGenerationHelper from hackingBuddyGPT.utils.prompt_generation.information import PromptStrategy, PromptC...
"double")
self.assertEqual
string_literal
tests/test_openAPI_specification_manager.py
test_get_type_double
TestOpenAPISpecificationHandler
135
null
ipa-lab/hackingBuddyGPT
import os import unittest from unittest.mock import MagicMock, patch from hackingBuddyGPT.utils.prompt_generation import PromptGenerationHelper from hackingBuddyGPT.utils.prompt_generation.information import PromptContext from hackingBuddyGPT.usecases.web_api_testing.response_processing.response_handler import ( R...
"#/components/schemas/Test")
self.assertEqual
string_literal
tests/test_response_handler.py
test_parse_http_response_to_schema
TestResponseHandler
102
null
ipa-lab/hackingBuddyGPT
import unittest from hackingBuddyGPT.utils.prompt_generation.information import PromptPurpose from hackingBuddyGPT.usecases.web_api_testing.response_processing.response_analyzer import ResponseAnalyzer class TestResponseAnalyzer(unittest.TestCase): def setUp(self): self.auth_headers = ( "HTTP/...
printed)
self.assertIn
variable
tests/test_response_analyzer.py
test_print_analysis_output_structure
TestResponseAnalyzer
94
null
ipa-lab/hackingBuddyGPT
import unittest from hackingBuddyGPT.utils.prompt_generation.information import PromptPurpose from hackingBuddyGPT.usecases.web_api_testing.response_processing.response_analyzer import ResponseAnalyzer class TestResponseAnalyzer(unittest.TestCase): def setUp(self): self.auth_headers = ( "HTTP/...
msg)
self.assertEqual
variable
tests/test_response_analyzer.py
test_parse_http_response_success
TestResponseAnalyzer
41
null
ipa-lab/hackingBuddyGPT
import unittest from hackingBuddyGPT.utils.prompt_generation import PromptGenerationHelper class TestPromptGenerationHelper(unittest.TestCase): def setUp(self): self.host = "https://reqres.in" self.description = "Fake API" self.prompt_helper = PromptGenerationHelper(self.host, self.descript...
"")
self.assertEqual
string_literal
tests/test_prompt_generation_helper.py
test_get_user_from_prompt
TestPromptGenerationHelper
24
null
ipa-lab/hackingBuddyGPT
import unittest from hackingBuddyGPT.utils.prompt_generation.information import PromptPurpose from hackingBuddyGPT.usecases.web_api_testing.response_processing.response_analyzer import ResponseAnalyzer class TestResponseAnalyzer(unittest.TestCase): def setUp(self): self.auth_headers = ( "HTTP/...
"Valid")
self.assertEqual
string_literal
tests/test_response_analyzer.py
test_is_valid_input_response
TestResponseAnalyzer
72
null
ipa-lab/hackingBuddyGPT
import os import unittest from unittest.mock import MagicMock, patch from hackingBuddyGPT.usecases.web_api_testing.simple_web_api_testing import ( SimpleWebAPITestingUseCase, SimpleWebAPITesting, ) from hackingBuddyGPT.utils import Console, DbStorage from hackingBuddyGPT.utils.logging import LocalLogger class Tes...
contents)
self.assertIn
variable
tests/test_web_api_testing.py
test_initial_prompt
TestSimpleWebAPITestingTest
40
null
ipa-lab/hackingBuddyGPT
import unittest from hackingBuddyGPT.utils.prompt_generation.information import PromptPurpose from hackingBuddyGPT.usecases.web_api_testing.response_processing.response_analyzer import ResponseAnalyzer class TestResponseAnalyzer(unittest.TestCase): def setUp(self): self.auth_headers = ( "HTTP/...
200)
self.assertEqual
numeric_literal
tests/test_response_analyzer.py
test_analyze_authentication
TestResponseAnalyzer
57
null
ipa-lab/hackingBuddyGPT
import os import unittest from unittest.mock import MagicMock, patch from hackingBuddyGPT.utils.prompt_generation import PromptGenerationHelper from hackingBuddyGPT.utils.prompt_generation.information import PromptContext from hackingBuddyGPT.usecases.web_api_testing.response_processing.response_handler import ( R...
openapi_spec)
self.assertEqual
variable
tests/test_response_handler.py
test_parse_http_response_to_openapi_example
TestResponseHandler
70
null
ipa-lab/hackingBuddyGPT
import unittest from unittest.mock import MagicMock from hackingBuddyGPT.usecases.web_api_testing.utils import LLMHandler class TestLLMHandler(unittest.TestCase): def setUp(self): self.llm_mock = MagicMock() self.capabilities = {"cap1": MagicMock(), "cap2": MagicMock()} self.llm_handler = ...
self.llm_handler.created_objects)
self.assertIn
complex_expr
tests/test_llm_handler.py
test_add_created_object
TestLLMHandler
38
null
ipa-lab/hackingBuddyGPT
import unittest from hackingBuddyGPT.utils.prompt_generation.information import PromptPurpose from hackingBuddyGPT.usecases.web_api_testing.response_processing.response_analyzer import ResponseAnalyzer class TestResponseAnalyzer(unittest.TestCase): def setUp(self): self.auth_headers = ( "HTTP/...
"Authenticated")
self.assertEqual
string_literal
tests/test_response_analyzer.py
test_analyze_authentication
TestResponseAnalyzer
58
null
ipa-lab/hackingBuddyGPT
import unittest from hackingBuddyGPT.utils.prompt_generation.information import PromptPurpose from hackingBuddyGPT.usecases.web_api_testing.response_processing.response_analyzer import ResponseAnalyzer class TestResponseAnalyzer(unittest.TestCase): def setUp(self): self.auth_headers = ( "HTTP/...
"Error")
self.assertEqual
string_literal
tests/test_response_analyzer.py
test_is_valid_input_response
TestResponseAnalyzer
74
null
ipa-lab/hackingBuddyGPT
import unittest from hackingBuddyGPT.utils.prompt_generation.information import PromptPurpose from hackingBuddyGPT.usecases.web_api_testing.response_processing.response_analyzer import ResponseAnalyzer class TestResponseAnalyzer(unittest.TestCase): def setUp(self): self.auth_headers = ( "HTTP/...
"Unexpected")
self.assertEqual
string_literal
tests/test_response_analyzer.py
test_is_valid_input_response
TestResponseAnalyzer
75
null
ipa-lab/hackingBuddyGPT
import os import unittest from unittest.mock import MagicMock, patch from hackingBuddyGPT.utils.prompt_generation import PromptGenerationHelper from hackingBuddyGPT.utils.prompt_generation.information import PromptContext from hackingBuddyGPT.usecases.web_api_testing.response_processing.response_handler import ( R...
entry_dict)
self.assertIn
variable
tests/test_response_handler.py
test_parse_http_response_to_openapi_example
TestResponseHandler
71
null
ipa-lab/hackingBuddyGPT
import unittest from unittest.mock import MagicMock from hackingBuddyGPT.usecases.web_api_testing.response_processing.response_analyzer_with_llm import ResponseAnalyzerWithLLM from hackingBuddyGPT.utils.prompt_generation.information import PromptPurpose class TestResponseAnalyzerWithLLM(unittest.TestCase): def se...
"Execution Result")
self.assertEqual
string_literal
tests/test_response_analyzer_with_llm.py
test_process_step_calls_llm_handler
TestResponseAnalyzerWithLLM
65
null
ipa-lab/hackingBuddyGPT
import os import unittest from unittest.mock import MagicMock, patch from hackingBuddyGPT.utils.logging import LocalLogger from hackingBuddyGPT.usecases.web_api_testing.simple_openapi_documentation import ( SimpleWebAPIDocumentation, SimpleWebAPIDocumentationUseCase, ) from hackingBuddyGPT.utils import Console...
result)
self.assertFalse
variable
tests/test_web_api_documentation.py
test_perform_round
TestSimpleWebAPIDocumentationTest
89
null