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 |
|---|---|---|---|---|---|---|---|---|---|
amerkurev/doku | from unittest import mock
import pytest
from fastapi import FastAPI
from server import state
from server.state import lifespan
def mock_settings():
with mock.patch('server.state.settings') as mock_settings:
mock_settings.VERSION = 'test_version'
mock_settings.BASIC_HTPASSWD = None
yield m... | None | assert | none_literal | app/server/tests/test_state.py | test_lifespan_no_credentials | 22 | null | |
amerkurev/doku | from unittest.mock import patch, MagicMock
import pytest
from scan.df import main
def mock_stop_signal():
"""Creates a mock that returns False 10 times, then True"""
mock = MagicMock()
mock.is_stop = MagicMock(side_effect=[False] * 10 + [True])
return mock
@patch('scan.df.SignalHandler')
@patch('sca... | 'DF scanner stopped.') | assert_* | string_literal | app/scan/tests/test_df.py | test_main | 42 | null | |
amerkurev/doku | from unittest.mock import patch
from settings import Settings, to_string as settings_to_string
from main import main
def patterns_assert(patterns: list[str]):
assert len(patterns) == 3
assert '/home/*' in patterns
assert '/tmp/*' in patterns
assert '*/.git/*' in patterns
def test_bindmount_ignore_pat... | 2 | assert | numeric_literal | app/test_main.py | test_bindmount_ignore_patterns_list | 170 | null | |
amerkurev/doku | from unittest.mock import MagicMock
import bcrypt
import pytest
from fastapi import HTTPException, Request
from fastapi.security import HTTPBasicCredentials
from server.auth import check_password, basic_auth
def test_check_password_valid():
password = 'testpassword'
hashed = bcrypt.hashpw(password.encode(), ... | True | assert | bool_literal | app/server/tests/test_auth.py | test_check_password_valid | 14 | null | |
amerkurev/doku | from unittest.mock import MagicMock
import bcrypt
import pytest
from fastapi import HTTPException, Request
from fastapi.security import HTTPBasicCredentials
from server.auth import check_password, basic_auth
def test_basic_auth_invalid_username():
# Test with invalid username
password = 'testpassword'
ha... | {'WWW-Authenticate': 'Basic'} | assert | collection | app/server/tests/test_auth.py | test_basic_auth_invalid_username | 62 | null | |
amerkurev/doku | from pathlib import Path
from unittest.mock import MagicMock, patch, call, ANY
import pytest
from docker.models.images import Image
from docker.models.containers import Container
from contrib.types import (
DockerMount,
DockerImageList,
DockerContainerList,
DockerVolumeList,
DockerBuildCacheList,
... | ANY) | assert_* | variable | app/scan/tests/test_scanner.py | test_logfiles_scanner | 193 | null | |
amerkurev/doku | from unittest.mock import patch, MagicMock
import pytest
from scan.du import main
def mock_stop_signal():
"""Creates a mock that returns False 10 times, then True"""
mock = MagicMock()
mock.is_stop = MagicMock(side_effect=[False] * 10 + [True])
return mock
@patch('scan.du.SignalHandler')
@patch('sca... | 'DU scanner started (bind mounts + overlay2).') | assert_* | string_literal | app/scan/tests/test_du.py | test_main | 41 | null | |
amerkurev/doku | import datetime
import pytest
from peewee import SqliteDatabase
from playhouse.kv import KeyValue
from contrib import kvstore
from contrib.types import DockerImage
def test_set_get(test_model):
db = SqliteDatabase(':memory:')
kv = KeyValue(database=db, table_name='test_kvstore')
with db:
# Test ... | test_model.containers | assert | complex_expr | app/contrib/tests/test_kvstore.py | test_set_get | 39 | null | |
amerkurev/doku | import os
from pathlib import Path
from unittest.mock import patch, MagicMock
import settings
from scan.utils import du_available, cpu_throttling, run_du, get_size, pretty_size
def test_get_size():
p = settings.BASE_DIR
assert get_size(Path(p), 0.1, lambda: True, use_du=True) == 0
s1 = get_size(Path(p), 0... | round(s2, -6) | assert | func_call | app/scan/tests/test_utils.py | test_get_size | 36 | null | |
amerkurev/doku | from unittest import mock
import pytest
from fastapi import FastAPI
from server import state
from server.state import lifespan
def mock_settings():
with mock.patch('server.state.settings') as mock_settings:
mock_settings.VERSION = 'test_version'
mock_settings.BASIC_HTPASSWD = None
yield m... | 'test_version' | assert | string_literal | app/server/tests/test_state.py | test_lifespan_no_credentials | 23 | null | |
amerkurev/doku | from datetime import datetime, timezone
from contrib.types import (
DockerVersion,
DockerImage,
DockerImageList,
DockerContainer,
DockerContainerList,
DockerVolume,
DockerVolumeList,
DockerBuildCache,
DockerBuildCacheList,
DockerSystemDF,
DockerMount,
DockerContainerLog,... | 2 | assert | numeric_literal | app/contrib/tests/test_types.py | test_docker_image_list | 97 | null | |
amerkurev/doku | from unittest.mock import MagicMock
import bcrypt
import pytest
from fastapi import HTTPException, Request
from fastapi.security import HTTPBasicCredentials
from server.auth import check_password, basic_auth
def test_basic_auth_invalid_username():
# Test with invalid username
password = 'testpassword'
ha... | 401 | assert | numeric_literal | app/server/tests/test_auth.py | test_basic_auth_invalid_username | 60 | null | |
amerkurev/doku | from unittest.mock import patch
from settings import Settings, to_string as settings_to_string
from main import main
def patterns_assert(patterns: list[str]):
assert len(patterns) == | 3 | assert | numeric_literal | app/test_main.py | patterns_assert | 132 | null | |
amerkurev/doku | import logging
import pytest
from unittest.mock import patch, MagicMock
from contrib.logger import get_logger, setup_logger, LOGGER_NAME
@pytest.mark.parametrize('in_docker', [True, False])
@patch('contrib.logger.logging')
@patch('contrib.logger.settings')
@patch('contrib.logger.DefaultFormatter')
def test_setup_log... | mock_formatter) | assert_* | variable | app/contrib/tests/test_logger.py | test_setup_logger_configuration | 47 | null | |
amerkurev/doku | from dataclasses import dataclass
from server.router.context import total_size
def test_total_size():
# Test total_size function
items = [
Item(size=1),
Item(size=2),
Item(size=3),
]
assert total_size(items) == | '6 Bytes' | assert | string_literal | app/server/tests/test_context.py | test_total_size | 23 | null | |
amerkurev/doku | from unittest.mock import patch, MagicMock
import pytest
from scan.du import main
def mock_stop_signal():
"""Creates a mock that returns False 10 times, then True"""
mock = MagicMock()
mock.is_stop = MagicMock(side_effect=[False] * 10 + [True])
return mock
@patch('scan.du.SignalHandler')
@patch('sca... | 10 | assert | numeric_literal | app/scan/tests/test_du.py | test_main | 53 | null | |
amerkurev/doku | from unittest.mock import MagicMock
import bcrypt
import pytest
from fastapi import HTTPException, Request
from fastapi.security import HTTPBasicCredentials
from server.auth import check_password, basic_auth
def test_basic_auth_invalid_username():
# Test with invalid username
password = 'testpassword'
ha... | 'Incorrect username or password' | assert | string_literal | app/server/tests/test_auth.py | test_basic_auth_invalid_username | 61 | null | |
amerkurev/doku | from pathlib import Path
from unittest.mock import Mock, patch
import docker
import pytest
from contrib.docker import (
docker_from_env,
doku_container,
doku_mounts,
_get_mounts,
map_host_path_to_container,
)
def docker_client_mock():
return Mock(spec=docker.DockerClient)
def container_mock(... | 1 | assert | numeric_literal | app/contrib/tests/test_docker.py | test_doku_mounts | 90 | null | |
amerkurev/doku | from unittest.mock import MagicMock
import bcrypt
import pytest
from fastapi import HTTPException, Request
from fastapi.security import HTTPBasicCredentials
from server.auth import check_password, basic_auth
def test_basic_auth_valid_credentials():
# Test with valid credentials
password = 'testpassword'
... | 'testuser' | assert | string_literal | app/server/tests/test_auth.py | test_basic_auth_valid_credentials | 45 | null | |
amerkurev/doku | import datetime
import pytest
from peewee import SqliteDatabase
from playhouse.kv import KeyValue
from contrib import kvstore
from contrib.types import DockerImage
def test_set_get(test_model):
db = SqliteDatabase(':memory:')
kv = KeyValue(database=db, table_name='test_kvstore')
with db:
# Test ... | test_model.id | assert | complex_expr | app/contrib/tests/test_kvstore.py | test_set_get | 34 | null | |
amerkurev/doku | from pathlib import Path
from unittest.mock import MagicMock, patch, call, ANY
import pytest
from docker.models.images import Image
from docker.models.containers import Container
from contrib.types import (
DockerMount,
DockerImageList,
DockerContainerList,
DockerVolumeList,
DockerBuildCacheList,
... | NotImplementedError) | pytest.raises | variable | app/scan/tests/test_scanner.py | test_base_scanner | 49 | null | |
amerkurev/doku | from dataclasses import dataclass
from server.router.context import total_size
def test_total_size():
# Test total_size function
items = [
Item(size=1),
Item(size=2),
Item(size=3),
]
assert total_size(items) == '6 Bytes'
items = [
ItemShared(shared_size=1024),
... | '1.1 GB' | assert | string_literal | app/server/tests/test_context.py | test_total_size | 30 | null | |
amerkurev/doku | from pathlib import Path
from unittest.mock import Mock, patch
import docker
import pytest
from contrib.docker import (
docker_from_env,
doku_container,
doku_mounts,
_get_mounts,
map_host_path_to_container,
)
def docker_client_mock():
return Mock(spec=docker.DockerClient)
def container_mock(... | Path('/dest/file.txt') | assert | func_call | app/contrib/tests/test_docker.py | test_map_host_path_host_mnt_prefix | 114 | null | |
amerkurev/doku | import os
from pathlib import Path
from unittest.mock import patch, MagicMock
import settings
from scan.utils import du_available, cpu_throttling, run_du, get_size, pretty_size
def test_pretty_size():
settings.SI = False
assert pretty_size(0) == '0'
assert pretty_size(1024) == '1.0 KiB'
assert pretty_... | '1.0 GB' | assert | string_literal | app/scan/tests/test_utils.py | test_pretty_size | 50 | null | |
amerkurev/doku | from pathlib import Path
from unittest.mock import Mock, patch
import docker
import pytest
from contrib.docker import (
docker_from_env,
doku_container,
doku_mounts,
_get_mounts,
map_host_path_to_container,
)
def docker_client_mock():
return Mock(spec=docker.DockerClient)
def container_mock(... | 'rw' | assert | string_literal | app/contrib/tests/test_docker.py | test_doku_mounts | 93 | null | |
amerkurev/doku | from dataclasses import dataclass
from server.router.context import total_size
def test_total_size():
# Test total_size function
items = [
Item(size=1),
Item(size=2),
Item(size=3),
]
assert total_size(items) == '6 Bytes'
items = [
ItemShared(shared_size=1024),
... | '0' | assert | string_literal | app/server/tests/test_context.py | test_total_size | 32 | null | |
amerkurev/doku | from unittest import mock
import pytest
from fastapi import FastAPI
from server import state
from server.state import lifespan
def mock_settings():
with mock.patch('server.state.settings') as mock_settings:
mock_settings.VERSION = 'test_version'
mock_settings.BASIC_HTPASSWD = None
yield m... | {'user': 'hash'} | assert | collection | app/server/tests/test_state.py | test_state_typed_dict | 52 | null | |
amerkurev/doku | from unittest.mock import patch
from settings import Settings, to_string as settings_to_string
from main import main
def patterns_assert(patterns: list[str]):
assert len(patterns) == 3
assert '/home/*' in patterns
assert '/tmp/*' in patterns
assert '*/.git/*' in patterns
def test_bindmount_ignore_pat... | 0 | assert | numeric_literal | app/test_main.py | test_bindmount_ignore_patterns_list | 164 | null | |
amerkurev/doku | from datetime import datetime, timezone
from contrib.types import (
DockerVersion,
DockerImage,
DockerImageList,
DockerContainer,
DockerContainerList,
DockerVolume,
DockerVolumeList,
DockerBuildCache,
DockerBuildCacheList,
DockerSystemDF,
DockerMount,
DockerContainerLog,... | 10 | assert | numeric_literal | app/contrib/tests/test_types.py | test_docker_build_cache_list | 264 | null | |
amerkurev/doku | import datetime
import pytest
from peewee import SqliteDatabase
from playhouse.kv import KeyValue
from contrib import kvstore
from contrib.types import DockerImage
def test_get_all(test_model):
db = SqliteDatabase(':memory:')
kv = KeyValue(database=db, table_name='test_kvstore')
with db:
# Test ... | 2 | assert | numeric_literal | app/contrib/tests/test_kvstore.py | test_get_all | 56 | null | |
amerkurev/doku | import os
from pathlib import Path
from unittest.mock import patch, MagicMock
import settings
from scan.utils import du_available, cpu_throttling, run_du, get_size, pretty_size
def test_cpu_throttling():
with patch('time.sleep') as mock_sleep:
for _ in range(100):
cpu_throttling(0.1)
... | 0.1) | assert_* | numeric_literal | app/scan/tests/test_utils.py | test_cpu_throttling | 13 | null | |
amerkurev/doku | from unittest.mock import patch
from settings import Settings, to_string as settings_to_string
from main import main
def patterns_assert(patterns: list[str]):
assert len(patterns) == 3
assert '/home/*' in patterns
assert '/tmp/*' in patterns
assert '*/.git/*' in patterns
def test_bindmount_ignore_pat... | 1 | assert | numeric_literal | app/test_main.py | test_bindmount_ignore_patterns_list | 157 | null | |
amerkurev/doku | import datetime
import pytest
from peewee import SqliteDatabase
from playhouse.kv import KeyValue
from contrib import kvstore
from contrib.types import DockerImage
def test_set_get(test_model):
db = SqliteDatabase(':memory:')
kv = KeyValue(database=db, table_name='test_kvstore')
with db:
# Test ... | test_model.created | assert | complex_expr | app/contrib/tests/test_kvstore.py | test_set_get | 35 | null | |
amerkurev/doku | from pathlib import Path
from unittest.mock import Mock, patch
import docker
import pytest
from contrib.docker import (
docker_from_env,
doku_container,
doku_mounts,
_get_mounts,
map_host_path_to_container,
)
def docker_client_mock():
return Mock(spec=docker.DockerClient)
def container_mock(... | '/container/path' | assert | string_literal | app/contrib/tests/test_docker.py | test_doku_mounts | 92 | null | |
amerkurev/doku | from unittest.mock import patch, MagicMock
import pytest
from scan.df import main
def mock_stop_signal():
"""Creates a mock that returns False 10 times, then True"""
mock = MagicMock()
mock.is_stop = MagicMock(side_effect=[False] * 10 + [True])
return mock
@patch('scan.df.SignalHandler')
@patch('sca... | 'DF scanner started (system df + logfiles).') | assert_* | string_literal | app/scan/tests/test_df.py | test_main | 41 | null | |
amerkurev/doku | from unittest.mock import patch, MagicMock
import pytest
from scan.df import main
def mock_stop_signal():
"""Creates a mock that returns False 10 times, then True"""
mock = MagicMock()
mock.is_stop = MagicMock(side_effect=[False] * 10 + [True])
return mock
@patch('scan.df.SignalHandler')
@patch('sca... | 2 | assert | numeric_literal | app/scan/tests/test_df.py | test_main | 50 | null | |
amerkurev/doku | import os
from pathlib import Path
from unittest.mock import patch, MagicMock
import settings
from scan.utils import du_available, cpu_throttling, run_du, get_size, pretty_size
def test_pretty_size():
settings.SI = False
assert pretty_size(0) == '0'
assert pretty_size(1024) == '1.0 KiB'
assert pretty_... | '1.0 kB' | assert | string_literal | app/scan/tests/test_utils.py | test_pretty_size | 48 | null | |
amerkurev/doku | from unittest import mock
import pytest
from fastapi import FastAPI
from server import state
from server.state import lifespan
def mock_settings():
with mock.patch('server.state.settings') as mock_settings:
mock_settings.VERSION = 'test_version'
mock_settings.BASIC_HTPASSWD = None
yield m... | {'user1': 'hash1', 'user2': 'hash2'} | assert | collection | app/server/tests/test_state.py | test_lifespan_with_credentials_file | 45 | null | |
amerkurev/doku | from pathlib import Path
from unittest.mock import MagicMock, patch, call, ANY
import pytest
from docker.models.images import Image
from docker.models.containers import Container
from contrib.types import (
DockerMount,
DockerImageList,
DockerContainerList,
DockerVolumeList,
DockerBuildCacheList,
... | 2 | assert | numeric_literal | app/scan/tests/test_scanner.py | test_bind_mounts_scanner | 245 | null | |
amerkurev/doku | from datetime import datetime, timezone
from contrib.types import (
DockerVersion,
DockerImage,
DockerImageList,
DockerContainer,
DockerContainerList,
DockerVolume,
DockerVolumeList,
DockerBuildCache,
DockerBuildCacheList,
DockerSystemDF,
DockerMount,
DockerContainerLog,... | 1000 | assert | numeric_literal | app/contrib/tests/test_types.py | test_docker_image | 57 | null | |
amerkurev/doku | import datetime
import pytest
from peewee import SqliteDatabase
from playhouse.kv import KeyValue
from contrib import kvstore
from contrib.types import DockerImage
def test_set_get(test_model):
db = SqliteDatabase(':memory:')
kv = KeyValue(database=db, table_name='test_kvstore')
with db:
# Test ... | test_model.size | assert | complex_expr | app/contrib/tests/test_kvstore.py | test_set_get | 38 | null | |
amerkurev/doku | import logging
import pytest
from unittest.mock import patch, MagicMock
from contrib.logger import get_logger, setup_logger, LOGGER_NAME
@pytest.mark.parametrize('in_docker', [True, False])
@patch('contrib.logger.logging')
@patch('contrib.logger.settings')
@patch('contrib.logger.DefaultFormatter')
def test_setup_log... | [] | assert | collection | app/contrib/tests/test_logger.py | test_setup_logger_configuration | 49 | null | |
EbodShojaei/bake | from pathlib import Path
from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules.assignment_alignment import AssignmentAlignmentRule
def create_alignment_config(
align_assignments: bool = True, align_across_comments: bool = False
) -> Config:
"... | "VAR4 = value4" | assert | string_literal | tests/test_assignment_alignment.py | test_conditional_blocks_break_alignment | TestAssignmentAlignment | 241 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules import (
AssignmentSpacingRule,
ContinuationRule,
PhonyRule,
TabsRule,
TargetSpacingRule,
WhitespaceRule,
)
class TestFinalNewlineRule:
def test_skips_when_disabled(sel... | 0 | assert | numeric_literal | tests/test_bake.py | test_skips_when_disabled | TestFinalNewlineRule | 142 | null |
EbodShojaei/bake | from pathlib import Path
from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules.assignment_alignment import AssignmentAlignmentRule
def create_alignment_config(
align_assignments: bool = True, align_across_comments: bool = False
) -> Config:
"... | expected_lines | assert | variable | tests/test_assignment_alignment.py | test_alignment_fixture | TestAssignmentAlignment | 195 | null |
EbodShojaei/bake | from pathlib import Path
from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules.assignment_alignment import AssignmentAlignmentRule
def create_alignment_config(
align_assignments: bool = True, align_across_comments: bool = False
) -> Config:
"... | "CC = gcc" | assert | string_literal | tests/test_assignment_alignment.py | test_basic_alignment | TestAssignmentAlignment | 57 | null |
EbodShojaei/bake | import platform
import subprocess
import tempfile
import time
from pathlib import Path
from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules import (
AssignmentSpacingRule,
ConditionalRule,
ContinuationRule,
PatternSpacingRule,
Pho... | 0 | assert | numeric_literal | tests/test_comprehensive.py | test_temp_file_cleanup | TestExecutionValidation | 745 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
class TestReversedAssignmentOperators:
def test_detect_reversed_operators_with_various_spacing(self):
"""Test detection of reversed operators with various spacing patterns."""
config = Config(format... | 6 | assert | numeric_literal | tests/test_reversed_assignment_operators.py | test_detect_reversed_operators_with_various_spacing | TestReversedAssignmentOperators | 131 | null |
EbodShojaei/bake | import io
import sys
from collections.abc import Generator
from pathlib import Path
import pytest
from typer.testing import CliRunner
from mbake.cli import app
from mbake.completions import ShellType, get_completion_script, write_completion_script
def temp_completion_file(tmp_path) -> Generator[Path, None, None]:
... | content | assert | variable | tests/test_completions.py | test_write_completion_script_file | 108 | null | |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
class TestReversedAssignmentOperators:
def test_multiple_reversed_operators_in_same_file(self):
"""Test detection of multiple reversed operators in the same file."""
config = Config(formatter=Format... | [1, 2, 3, 4, 5] | assert | collection | tests/test_reversed_assignment_operators.py | test_multiple_reversed_operators_in_same_file | TestReversedAssignmentOperators | 220 | null |
EbodShojaei/bake | import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from typer.testing import CliRunner
from mbake.cli import app
class TestValidateCommand:
def runner(self):
"""Create a CLI runner for testing."""
return CliRunner()
def test_validate_simple_makefile(self,... | 0 | assert | numeric_literal | tests/test_validate_command.py | test_validate_simple_makefile | TestValidateCommand | 34 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
class TestAutoPhonyInsertion:
def test_unusual_suffix_patterns(self):
"""Test detection of unusual suffix patterns."""
config = Config(
formatter=FormatterConfig(
auto_in... | 2 | assert | numeric_literal | tests/test_auto_phony_insertion.py | test_unusual_suffix_patterns | TestAutoPhonyInsertion | 818 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
class TestReversedAssignmentOperators:
def test_detect_reversed_question_mark_operator(self):
"""Test detection of =? (should be ?=)."""
config = Config(formatter=FormatterConfig())
formatte... | None | assert | none_literal | tests/test_reversed_assignment_operators.py | test_detect_reversed_question_mark_operator | TestReversedAssignmentOperators | 38 | null |
EbodShojaei/bake | import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from typer.testing import CliRunner
from mbake.cli import app
class TestValidateCommand:
def runner(self):
"""Create a CLI runner for testing."""
return CliRunner()
def test_validate_simple_makefile(self,... | Path(makefile_path).parent | assert | func_call | tests/test_validate_command.py | test_validate_simple_makefile | TestValidateCommand | 48 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
class TestGNUErrorFormat:
def test_real_world_input_mk_scenario(self):
"""Test the exact scenario from input.mk to ensure console output matches expectations."""
config = Config(
formatt... | None | assert | none_literal | tests/test_gnu_error_format.py | test_real_world_input_mk_scenario | TestGNUErrorFormat | 160 | null |
EbodShojaei/bake | from pathlib import Path
from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules.assignment_alignment import AssignmentAlignmentRule
def create_alignment_config(
align_assignments: bool = True, align_across_comments: bool = False
) -> Config:
"... | "CFLAGS = -Wall" | assert | string_literal | tests/test_assignment_alignment.py | test_basic_alignment | TestAssignmentAlignment | 59 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
class TestAutoPhonyInsertion:
def test_auto_insert_common_phony_targets(self):
"""Test auto-insertion of common phony targets."""
config = Config(
formatter=FormatterConfig(
... | phony_line | assert | variable | tests/test_auto_phony_insertion.py | test_auto_insert_common_phony_targets | TestAutoPhonyInsertion | 47 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
class TestGNUErrorFormat:
def test_real_world_input_mk_scenario(self):
"""Test the exact scenario from input.mk to ensure console output matches expectations."""
config = Config(
formatt... | install_error | assert | variable | tests/test_gnu_error_format.py | test_real_world_input_mk_scenario | TestGNUErrorFormat | 161 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
class TestReversedAssignmentOperators:
def test_warning_message_format(self):
"""Test that warning messages have the correct format."""
config = Config(formatter=FormatterConfig())
formatter... | 1 | assert | numeric_literal | tests/test_reversed_assignment_operators.py | test_warning_message_format | TestReversedAssignmentOperators | 180 | null |
EbodShojaei/bake | from unittest.mock import patch
import pytest
from typer.testing import CliRunner
from mbake.cli import app
from mbake.config import Config, FormatterConfig
class TestCLIFormat:
def runner(self):
"""Create a CLI runner for testing."""
return CliRunner()
def test_format_stdin_basic(self, run... | 0 | assert | numeric_literal | tests/test_cli.py | test_format_stdin_basic | TestCLIFormat | 43 | null |
EbodShojaei/bake | import io
import sys
from collections.abc import Generator
from pathlib import Path
import pytest
from typer.testing import CliRunner
from mbake.cli import app
from mbake.completions import ShellType, get_completion_script, write_completion_script
def temp_completion_file(tmp_path) -> Generator[Path, None, None]:
... | 1 | assert | numeric_literal | tests/test_completions.py | test_completions_invalid_shell | 59 | null | |
EbodShojaei/bake | from unittest.mock import patch
import pytest
from typer.testing import CliRunner
from mbake.cli import app
from mbake.config import Config, FormatterConfig
class TestCLIFormat:
def runner(self):
"""Create a CLI runner for testing."""
return CliRunner()
def test_format_stdin_with_errors(sel... | result.stdout | assert | complex_expr | tests/test_cli.py | test_format_stdin_with_errors | TestCLIFormat | 67 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
class TestAutoPhonyInsertion:
def test_phony_target_detection_with_suffix_rules(self):
"""Test that phony detection correctly handles suffix rules and file targets."""
# Enable auto-insertion for th... | 0 | assert | numeric_literal | tests/test_auto_phony_insertion.py | test_phony_target_detection_with_suffix_rules | TestAutoPhonyInsertion | 582 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
class TestAutoPhonyInsertion:
def test_phony_target_detection_with_suffix_rules(self):
"""Test that phony detection correctly handles suffix rules and file targets."""
# Enable auto-insertion for th... | warning | assert | variable | tests/test_auto_phony_insertion.py | test_phony_target_detection_with_suffix_rules | TestAutoPhonyInsertion | 557 | null |
EbodShojaei/bake | import platform
import subprocess
import tempfile
import time
from pathlib import Path
from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules import (
AssignmentSpacingRule,
ConditionalRule,
ContinuationRule,
PatternSpacingRule,
Pho... | [] | assert | collection | tests/test_comprehensive.py | test_error_handling | TestFormatterBasics | 700 | null |
EbodShojaei/bake | from pathlib import Path
from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules.assignment_alignment import AssignmentAlignmentRule
def create_alignment_config(
align_assignments: bool = True, align_across_comments: bool = False
) -> Config:
"... | "EMPTY =" | assert | string_literal | tests/test_assignment_alignment.py | test_empty_value_alignment | TestAssignmentAlignment | 177 | null |
EbodShojaei/bake | import platform
import subprocess
import tempfile
import time
from pathlib import Path
from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules import (
AssignmentSpacingRule,
ConditionalRule,
ContinuationRule,
PatternSpacingRule,
Pho... | warning | assert | variable | tests/test_comprehensive.py | test_suffix_phony_issue_fixture | TestSuffixRules | 1,593 | null |
EbodShojaei/bake | import io
import sys
from collections.abc import Generator
from pathlib import Path
import pytest
from typer.testing import CliRunner
from mbake.cli import app
from mbake.completions import ShellType, get_completion_script, write_completion_script
def temp_completion_file(tmp_path) -> Generator[Path, None, None]:
... | zsh_script | assert | variable | tests/test_completions.py | test_get_completion_script | 76 | null | |
EbodShojaei/bake | import platform
import subprocess
import tempfile
import time
from pathlib import Path
from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules import (
AssignmentSpacingRule,
ConditionalRule,
ContinuationRule,
PatternSpacingRule,
Pho... | len(lines) | assert | func_call | tests/test_comprehensive.py | test_file_support_detection | TestFormatterBasics | 671 | null |
EbodShojaei/bake | import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from typer.testing import CliRunner
from mbake.cli import app
class TestValidateCommand:
def runner(self):
"""Create a CLI runner for testing."""
return CliRunner()
def test_validate_simple_makefile(self,... | [ "make", "-f", Path(makefile_path).name, "--dry-run", "--just-print", ] | assert | collection | tests/test_validate_command.py | test_validate_simple_makefile | TestValidateCommand | 41 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules import (
AssignmentSpacingRule,
ContinuationRule,
PhonyRule,
TabsRule,
TargetSpacingRule,
WhitespaceRule,
)
class TestMakefileFormatter:
def test_applies_all_rules(self... | formatted_lines | assert | variable | tests/test_bake.py | test_applies_all_rules | TestMakefileFormatter | 246 | null |
EbodShojaei/bake | from unittest.mock import MagicMock, patch
import pytest
from mbake.utils.version_utils import (
VersionError,
check_for_updates,
get_pypi_version,
is_development_install,
parse_version,
)
class TestCheckForUpdates:
@patch("mbake.utils.version_utils.get_pypi_version")
@patch("mbake.utils... | True | assert | bool_literal | tests/test_version_utils.py | test_update_available | TestCheckForUpdates | 116 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
class TestGNUErrorFormat:
def test_combined_errors_line_numbers(self):
"""Test that multiple error types report correct original line numbers."""
config = Config(
formatter=FormatterConf... | duplicate_errors[0] | assert | complex_expr | tests/test_gnu_error_format.py | test_combined_errors_line_numbers | TestGNUErrorFormat | 107 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
class TestGNUErrorFormat:
def test_duplicate_target_error_format(self):
"""Test that duplicate target errors include line numbers."""
config = Config(formatter=FormatterConfig(), gnu_error_format=Tr... | errors[0] | assert | complex_expr | tests/test_gnu_error_format.py | test_duplicate_target_error_format | TestGNUErrorFormat | 28 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules import (
AssignmentSpacingRule,
ContinuationRule,
PhonyRule,
TabsRule,
TargetSpacingRule,
WhitespaceRule,
)
class TestContinuationRule:
def test_formats_simple_continua... | 3 | assert | numeric_literal | tests/test_bake.py | test_formats_simple_continuation | TestContinuationRule | 172 | null |
EbodShojaei/bake | import platform
import subprocess
import tempfile
import time
from pathlib import Path
from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules import (
AssignmentSpacingRule,
ConditionalRule,
ContinuationRule,
PatternSpacingRule,
Pho... | makefile_text | assert | variable | tests/test_comprehensive.py | test_temp_file_cleanup | TestExecutionValidation | 749 | null |
EbodShojaei/bake | from pathlib import Path
from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules.assignment_alignment import AssignmentAlignmentRule
def create_alignment_config(
align_assignments: bool = True, align_across_comments: bool = False
) -> Config:
"... | "\t@echo done" | assert | string_literal | tests/test_assignment_alignment.py | test_recipe_lines_not_aligned | TestAssignmentAlignment | 160 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
class TestAutoPhonyInsertion:
def test_auto_insert_common_phony_targets(self):
"""Test auto-insertion of common phony targets."""
config = Config(
formatter=FormatterConfig(
... | targets | assert | variable | tests/test_auto_phony_insertion.py | test_auto_insert_common_phony_targets | TestAutoPhonyInsertion | 56 | null |
EbodShojaei/bake | from unittest.mock import MagicMock, patch
import pytest
from mbake.utils.version_utils import (
VersionError,
check_for_updates,
get_pypi_version,
is_development_install,
parse_version,
)
class TestGetPypiVersion:
@patch("urllib.request.urlopen")
def test_successful_fetch(self, mock_url... | "1.2.3" | assert | string_literal | tests/test_version_utils.py | test_successful_fetch | TestGetPypiVersion | 81 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules import (
AssignmentSpacingRule,
ContinuationRule,
PhonyRule,
TabsRule,
TargetSpacingRule,
WhitespaceRule,
)
class TestPhonyRule:
def test_groups_phony_declarations(self... | phony_line | assert | variable | tests/test_bake.py | test_groups_phony_declarations | TestPhonyRule | 220 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
class TestReversedAssignmentOperators:
def test_multiple_reversed_operators_in_same_file(self):
"""Test detection of multiple reversed operators in the same file."""
config = Config(formatter=Format... | 5 | assert | numeric_literal | tests/test_reversed_assignment_operators.py | test_multiple_reversed_operators_in_same_file | TestReversedAssignmentOperators | 211 | null |
EbodShojaei/bake | from pathlib import Path
from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules.assignment_alignment import AssignmentAlignmentRule
def create_alignment_config(
align_assignments: bool = True, align_across_comments: bool = False
) -> Config:
"... | "endif" | assert | string_literal | tests/test_assignment_alignment.py | test_conditional_blocks_break_alignment | TestAssignmentAlignment | 239 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules import (
AssignmentSpacingRule,
ContinuationRule,
PhonyRule,
TabsRule,
TargetSpacingRule,
WhitespaceRule,
)
class TestMakefileFormatter:
def test_handles_file_formattin... | content | assert | variable | tests/test_bake.py | test_handles_file_formatting | TestMakefileFormatter | 265 | null |
EbodShojaei/bake | import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from typer.testing import CliRunner
from mbake.cli import app
class TestValidateCommand:
def runner(self):
"""Create a CLI runner for testing."""
return CliRunner()
def test_validate_makefile_with_relativ... | [ "make", "-f", "Makefile", "--dry-run", "--just-print", ] | assert | collection | tests/test_validate_command.py | test_validate_makefile_with_relative_include | TestValidateCommand | 87 | null |
EbodShojaei/bake | from unittest.mock import patch
import pytest
from typer.testing import CliRunner
from mbake.cli import app
from mbake.config import Config, FormatterConfig
class TestCLIFormat:
def runner(self):
"""Create a CLI runner for testing."""
return CliRunner()
def test_format_stdin_preserves_empty... | "" | assert | string_literal | tests/test_cli.py | test_format_stdin_preserves_empty_input | TestCLIFormat | 121 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules import (
AssignmentSpacingRule,
ContinuationRule,
PhonyRule,
TabsRule,
TargetSpacingRule,
WhitespaceRule,
)
class TestFinalNewlineRule:
def test_detects_missing_final_n... | result.check_messages[0] | assert | complex_expr | tests/test_bake.py | test_detects_missing_final_newline | TestFinalNewlineRule | 130 | null |
EbodShojaei/bake | import io
import sys
from collections.abc import Generator
from pathlib import Path
import pytest
from typer.testing import CliRunner
from mbake.cli import app
from mbake.completions import ShellType, get_completion_script, write_completion_script
def temp_completion_file(tmp_path) -> Generator[Path, None, None]:
... | bash_script | assert | variable | tests/test_completions.py | test_get_completion_script | 67 | null | |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
class TestReversedAssignmentOperators:
def test_warning_message_format(self):
"""Test that warning messages have the correct format."""
config = Config(formatter=FormatterConfig())
formatter... | warning | assert | variable | tests/test_reversed_assignment_operators.py | test_warning_message_format | TestReversedAssignmentOperators | 185 | null |
EbodShojaei/bake | from pathlib import Path
from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules.assignment_alignment import AssignmentAlignmentRule
def create_alignment_config(
align_assignments: bool = True, align_across_comments: bool = False
) -> Config:
"... | "CXX := g++" | assert | string_literal | tests/test_assignment_alignment.py | test_basic_alignment | TestAssignmentAlignment | 58 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
class TestReversedAssignmentOperators:
def test_detect_reversed_question_mark_operator(self):
"""Test detection of =? (should be ?=)."""
config = Config(formatter=FormatterConfig())
formatte... | plus_warning | assert | variable | tests/test_reversed_assignment_operators.py | test_detect_reversed_question_mark_operator | TestReversedAssignmentOperators | 59 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
class TestAutoPhonyInsertion:
def test_consolidate_multiple_phony_declarations(self):
"""Test that multiple .PHONY declarations are consolidated into one."""
config = Config(
formatter=F... | 1 | assert | numeric_literal | tests/test_auto_phony_insertion.py | test_consolidate_multiple_phony_declarations | TestAutoPhonyInsertion | 297 | null |
EbodShojaei/bake | import platform
import subprocess
import tempfile
import time
from pathlib import Path
from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules import (
AssignmentSpacingRule,
ConditionalRule,
ContinuationRule,
PatternSpacingRule,
Pho... | [expected] | assert | collection | tests/test_comprehensive.py | test_assignment_operator_spacing | TestVariableAssignments | 115 | null |
EbodShojaei/bake | import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from typer.testing import CliRunner
from mbake.cli import app
class TestValidateCommand:
def runner(self):
"""Create a CLI runner for testing."""
return CliRunner()
def test_validate_nonexistent_file(self... | result.stdout | assert | complex_expr | tests/test_validate_command.py | test_validate_nonexistent_file | TestValidateCommand | 116 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
class TestReversedAssignmentOperators:
def test_no_warnings_for_correct_operators(self):
"""Test that correct operators don't generate warnings."""
config = Config(formatter=FormatterConfig())
... | 0 | assert | numeric_literal | tests/test_reversed_assignment_operators.py | test_no_warnings_for_correct_operators | TestReversedAssignmentOperators | 86 | null |
EbodShojaei/bake | from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules import (
AssignmentSpacingRule,
ContinuationRule,
PhonyRule,
TabsRule,
TargetSpacingRule,
WhitespaceRule,
)
class TestContinuationRule:
def test_formats_simple_continua... | " file2.c \\" | assert | string_literal | tests/test_bake.py | test_formats_simple_continuation | TestContinuationRule | 174 | null |
EbodShojaei/bake | from unittest.mock import MagicMock, patch
import pytest
from mbake.utils.version_utils import (
VersionError,
check_for_updates,
get_pypi_version,
is_development_install,
parse_version,
)
class TestGetPypiVersion:
@patch("urllib.request.urlopen")
def test_network_error(self, mock_urlope... | None | assert | none_literal | tests/test_version_utils.py | test_network_error | TestGetPypiVersion | 91 | null |
EbodShojaei/bake | from pathlib import Path
from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules.assignment_alignment import AssignmentAlignmentRule
def create_alignment_config(
align_assignments: bool = True, align_across_comments: bool = False
) -> Config:
"... | "VAR3 = value3" | assert | string_literal | tests/test_assignment_alignment.py | test_conditional_blocks_break_alignment | TestAssignmentAlignment | 238 | null |
EbodShojaei/bake | import io
import sys
from collections.abc import Generator
from pathlib import Path
import pytest
from typer.testing import CliRunner
from mbake.cli import app
from mbake.completions import ShellType, get_completion_script, write_completion_script
def temp_completion_file(tmp_path) -> Generator[Path, None, None]:
... | output | assert | variable | tests/test_completions.py | test_write_completion_script_stdout | 97 | null | |
EbodShojaei/bake | from pathlib import Path
from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules.assignment_alignment import AssignmentAlignmentRule
def create_alignment_config(
align_assignments: bool = True, align_across_comments: bool = False
) -> Config:
"... | "# comment" | assert | string_literal | tests/test_assignment_alignment.py | test_comments_break_blocks | TestAssignmentAlignment | 104 | null |
EbodShojaei/bake | from pathlib import Path
from mbake.config import Config, FormatterConfig
from mbake.core.formatter import MakefileFormatter
from mbake.core.rules.assignment_alignment import AssignmentAlignmentRule
def create_alignment_config(
align_assignments: bool = True, align_across_comments: bool = False
) -> Config:
"... | input_lines | assert | variable | tests/test_assignment_alignment.py | test_single_assignment_not_aligned | TestAssignmentAlignment | 143 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.