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 |
|---|---|---|---|---|---|---|---|---|---|
chiphuyen/sniffly | import hashlib
import json
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sniffly.core.processor import ClaudeLogProcessor
class TestProcessorOptimizationCorrectness(unittest.TestCase):
def setUpClass(cls):
"""Set up test data di... | "Message type counts should be identical") | self.assertEqual | string_literal | tests/sniffly/test_processor_optimization_correctness.py | test_statistics_unchanged | TestProcessorOptimizationCorrectness | 97 | null |
chiphuyen/sniffly | import pytest
from sniffly.utils.memory_cache import MemoryCache
class TestMemoryCache:
def test_basic_get_put(self):
"""Test basic cache operations."""
cache = MemoryCache(max_projects=3)
# Test miss
result = cache.get("/path/to/project1")
assert result is None
... | 1 | assert | numeric_literal | tests/sniffly/utils/test_memory_cache.py | test_basic_get_put | TestMemoryCache | 21 | null |
chiphuyen/sniffly | import hashlib
import json
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sniffly.core.processor import ClaudeLogProcessor
class TestProcessorOptimizationCorrectness(unittest.TestCase):
def setUpClass(cls):
"""Set up test data di... | "Tool usage counts should be identical") | self.assertEqual | string_literal | tests/sniffly/test_processor_optimization_correctness.py | test_tool_usage_consistency | TestProcessorOptimizationCorrectness | 140 | null |
chiphuyen/sniffly | import os
import sys
import unittest
from collections import defaultdict
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sniffly.core.processor import ClaudeLogProcessor
class TestActualDataVerification(unittest.TestCase):
def setUpClass(cls):
"""Set up test data dir... | "Should have only one model") | self.assertEqual | string_literal | tests/sniffly/test_processor_data_verification.py | test_model_usage | TestActualDataVerification | 118 | null |
chiphuyen/sniffly | import json
import os
from pathlib import Path
from unittest.mock import patch
import pytest
from click.testing import CliRunner
from sniffly.cli import cli
from sniffly.config import Config
class TestConfig:
def test_config_file_persistence(self):
"""Test configuration persists to file."""
with... | 9000 | assert | numeric_literal | tests/sniffly/test_cli.py | test_config_file_persistence | TestConfig | 180 | null |
chiphuyen/sniffly | import logging
from datetime import datetime, timedelta
from unittest.mock import Mock, patch
import pytest
from sniffly.core.global_aggregator import GlobalStatsAggregator
class TestGlobalStatsAggregator:
def mock_caches(self):
"""Create mock cache instances."""
memory_cache = Mock()
fi... | 75 | assert | numeric_literal | tests/sniffly/core/test_global_aggregator.py | test_get_global_stats_basic | TestGlobalStatsAggregator | 129 | null |
chiphuyen/sniffly | import json
import os
import shutil
import sys
import tempfile
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from sniffly.core.processor import ClaudeLogProcessor, Interaction
class TestProcessorHelpers(unittest.TestCase):
def test_interaction_... | 'claude-3-sonnet') | self.assertEqual | string_literal | tests/sniffly/core/test_processor.py | test_interaction_class | TestProcessorHelpers | 308 | null |
chiphuyen/sniffly | import logging
from datetime import datetime, timedelta
from unittest.mock import Mock, patch
import pytest
from sniffly.core.global_aggregator import GlobalStatsAggregator
class TestGlobalStatsAggregator:
def mock_caches(self):
"""Create mock cache instances."""
memory_cache = Mock()
fi... | 5000 | assert | numeric_literal | tests/sniffly/core/test_global_aggregator.py | test_daily_aggregation | TestGlobalStatsAggregator | 180 | null |
chiphuyen/sniffly | import json
import os
import sys
import unittest
from collections import defaultdict
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from sniffly.core.constants import USER_INTERRUPTION_PATTERNS
from sniffly.core.processor import ClaudeLogProcessor
from sniffly.core.s... | "PDT should have 24 hours") | self.assertEqual | string_literal | tests/sniffly/core/test_stats.py | test_hourly_pattern_with_timezone | TestStatisticsCalculations | 602 | null |
chiphuyen/sniffly | import json
import os
import tempfile
from datetime import datetime
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from sniffly.share import ShareManager
def temp_dir():
"""Create a temporary directory for testing."""
with tempfile.TemporaryDirectory() as tmpdir:... | entry | assert | variable | tests/sniffly/test_share.py | test_share_logging | TestShareManager | 167 | null |
chiphuyen/sniffly | import json
import os
import sys
import tempfile
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
from fastapi import HTTPException
from fastapi.testclient import TestClient
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), '..', 'sniff... | 500 | assert | numeric_literal | tests/sniffly-site/test_admin.py | test_admin_login_missing_oauth_config | TestAdminAuthEndpoints | 183 | null |
chiphuyen/sniffly | import json
import os
import shutil
import sys
import tempfile
import time
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sniffly.core.processor import ClaudeLogProcessor
from sniffly.utils.local_cache import LocalCacheService
from sniffly.utils.memory_cache impor... | cached_messages) | self.assertIsNotNone | variable | tests/sniffly/test_performance.py | test_file_cache_performance | TestProcessingPerformance | 261 | null |
chiphuyen/sniffly | import json
import os
import tempfile
from datetime import datetime
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from sniffly.share import ShareManager
def temp_dir():
"""Create a temporary directory for testing."""
with tempfile.TemporaryDirectory() as tmpdir:... | False | assert | bool_literal | tests/sniffly/test_share.py | test_create_share_link_basic | TestShareManager | 89 | null |
chiphuyen/sniffly | import json
import os
import shutil
import sys
import tempfile
import time
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sniffly.core.processor import ClaudeLogProcessor
from sniffly.utils.local_cache import LocalCacheService
from sniffly.utils.memory_cache impor... | f"{endpoint} should respond in under 100ms") | self.assertLess | string_literal | tests/sniffly/test_performance.py | test_dashboard_api_response_time | TestProcessingPerformance | 361 | null |
chiphuyen/sniffly | import json
import os
from pathlib import Path
from unittest.mock import patch
import pytest
from click.testing import CliRunner
from sniffly.cli import cli
from sniffly.config import Config
class TestCLICommands:
def setup_method(self):
"""Set up test environment."""
self.runner = CliRunner()
... | 8090 | assert | numeric_literal | tests/sniffly/test_cli.py | test_config_set | TestCLICommands | 76 | null |
chiphuyen/sniffly | import json
import os
import tempfile
from datetime import datetime
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from sniffly.share import ShareManager
def temp_dir():
"""Create a temporary directory for testing."""
with tempfile.TemporaryDirectory() as tmpdir:... | "1.5K" | assert | string_literal | tests/sniffly/test_share.py | test_format_number | TestShareManager | 194 | null |
chiphuyen/sniffly | import json
import os
from pathlib import Path
from unittest.mock import patch
import pytest
from click.testing import CliRunner
from sniffly.cli import cli
from sniffly.config import Config
class TestCLICommands:
def setup_method(self):
"""Set up test environment."""
self.runner = CliRunner()
... | 0 | assert | numeric_literal | tests/sniffly/test_cli.py | test_version_command | TestCLICommands | 24 | null |
chiphuyen/sniffly | import json
import os
import sys
import tempfile
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
from fastapi import HTTPException
from fastapi.testclient import TestClient
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), '..', 'sniff... | 2 | assert | numeric_literal | tests/sniffly-site/test_admin.py | test_get_gallery | TestAdminAPIEndpoints | 324 | null |
chiphuyen/sniffly | import json
import os
import sys
import tempfile
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
class TestMemoryCacheFunctionality:
def test_memory_cache_basic_operations(self):
"""Test ... | 0 | assert | numeric_literal | tests/sniffly/test_server.py | test_memory_cache_basic_operations | TestMemoryCacheFunctionality | 191 | null |
chiphuyen/sniffly | import json
import os
import sys
import tempfile
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
from fastapi import HTTPException
from fastapi.testclient import TestClient
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), '..', 'sniff... | 1 | assert | numeric_literal | tests/sniffly-site/test_admin.py | test_remove_project | TestAdminAPIEndpoints | 424 | null |
chiphuyen/sniffly | import json
import os
import shutil
import sys
import tempfile
import time
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sniffly.core.processor import ClaudeLogProcessor
from sniffly.utils.local_cache import LocalCacheService
from sniffly.utils.memory_cache impor... | cached_result) | self.assertIsNotNone | variable | tests/sniffly/test_performance.py | test_memory_cache_performance | TestProcessingPerformance | 227 | null |
chiphuyen/sniffly | import os
import sys
import unittest
from collections import defaultdict
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sniffly.core.processor import ClaudeLogProcessor
class TestActualDataVerification(unittest.TestCase):
def setUpClass(cls):
"""Set up test data dir... | "Cache hit rate should be ~95.6%") | self.assertAlmostEqual | string_literal | tests/sniffly/test_processor_data_verification.py | test_cache_statistics | TestActualDataVerification | 180 | null |
chiphuyen/sniffly | import os
import sys
import unittest
from collections import defaultdict
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sniffly.core.processor import ClaudeLogProcessor
class TestActualDataVerification(unittest.TestCase):
def setUpClass(cls):
"""Set up test data dir... | "Should have init command") | self.assertGreater | string_literal | tests/sniffly/test_processor_data_verification.py | test_specific_user_commands | TestActualDataVerification | 203 | null |
chiphuyen/sniffly | import pytest
from sniffly.utils.memory_cache import MemoryCache
class TestMemoryCache:
def test_lru_eviction(self):
"""Test LRU eviction when cache is full."""
cache = MemoryCache(max_projects=2)
# Fill cache
cache.put("/project1", [{"id": 1}], {"total": 1})
cach... | 2 | assert | numeric_literal | tests/sniffly/utils/test_memory_cache.py | test_lru_eviction | TestMemoryCache | 45 | null |
chiphuyen/sniffly | import hashlib
import json
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sniffly.core.processor import ClaudeLogProcessor
class TestProcessorOptimizationCorrectness(unittest.TestCase):
def setUpClass(cls):
"""Set up test data di... | "User command count should be identical") | self.assertEqual | string_literal | tests/sniffly/test_processor_optimization_correctness.py | test_statistics_unchanged | TestProcessorOptimizationCorrectness | 112 | null |
chiphuyen/sniffly | import json
import os
from pathlib import Path
from unittest.mock import patch
import pytest
from click.testing import CliRunner
from sniffly.cli import cli
from sniffly.config import Config
class TestConfig:
def test_defaults(self):
"""Test default configuration values."""
with CliRunner().isol... | 5 | assert | numeric_literal | tests/sniffly/test_cli.py | test_defaults | TestConfig | 168 | null |
chiphuyen/sniffly | import json
import os
import tempfile
from datetime import datetime
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from sniffly.share import ShareManager
def temp_dir():
"""Create a temporary directory for testing."""
with tempfile.TemporaryDirectory() as tmpdir:... | 1 | assert | numeric_literal | tests/sniffly/test_share.py | test_create_share_link_public_with_commands | TestShareManager | 135 | null |
chiphuyen/sniffly | import json
import os
import shutil
import sys
import tempfile
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from sniffly.core.processor import ClaudeLogProcessor, Interaction
class TestClaudeLogProcessor(unittest.TestCase):
def setUpClass(cls)... | summary) | self.assertIn | variable | tests/sniffly/core/test_processor.py | test_summary_handling | TestClaudeLogProcessor | 251 | null |
chiphuyen/sniffly | import logging
from datetime import datetime, timedelta
from unittest.mock import Mock, patch
import pytest
from sniffly.core.global_aggregator import GlobalStatsAggregator
class TestGlobalStatsAggregator:
def mock_caches(self):
"""Create mock cache instances."""
memory_cache = Mock()
fi... | 2 | assert | numeric_literal | tests/sniffly/core/test_global_aggregator.py | test_get_global_stats_basic | TestGlobalStatsAggregator | 124 | null |
chiphuyen/sniffly | import json
import os
import sys
import unittest
from collections import defaultdict
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from sniffly.core.constants import USER_INTERRUPTION_PATTERNS
from sniffly.core.processor import ClaudeLogProcessor
from sniffly.core.s... | cost_data) | self.assertIn | variable | tests/sniffly/core/test_stats.py | test_model_cost_calculation | TestStatisticsCalculations | 384 | null |
chiphuyen/sniffly | import json
import os
import tempfile
from datetime import datetime
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from sniffly.share import ShareManager
def temp_dir():
"""Create a temporary directory for testing."""
with tempfile.TemporaryDirectory() as tmpdir:... | True | assert | bool_literal | tests/sniffly/test_share.py | test_create_share_link_public_with_commands | TestShareManager | 125 | null |
chiphuyen/sniffly | import json
import os
import sys
import tempfile
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
from fastapi import HTTPException
from fastapi.testclient import TestClient
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), '..', 'sniff... | 403 | assert | numeric_literal | tests/sniffly-site/test_admin.py | test_admin_callback_unauthorized_user | TestAdminAuthEndpoints | 262 | null |
chiphuyen/sniffly | import json
import os
import shutil
import sys
import tempfile
import time
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sniffly.core.processor import ClaudeLogProcessor
from sniffly.utils.local_cache import LocalCacheService
from sniffly.utils.memory_cache impor... | "Should use less than 0.5 MB per message") | self.assertLess | string_literal | tests/sniffly/test_performance.py | test_memory_efficiency | TestProcessingPerformance | 193 | null |
chiphuyen/sniffly | import json
import os
import tempfile
from datetime import datetime
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from sniffly.share import ShareManager
def temp_dir():
"""Create a temporary directory for testing."""
with tempfile.TemporaryDirectory() as tmpdir:... | "test" | assert | string_literal | tests/sniffly/test_share.py | test_sanitize_statistics | TestShareManager | 184 | null |
chiphuyen/sniffly | import os
import sys
import unittest
from collections import defaultdict
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sniffly.core.processor import ClaudeLogProcessor
class TestActualDataVerification(unittest.TestCase):
def setUpClass(cls):
"""Set up test data dir... | "Should have conda commands") | self.assertGreater | string_literal | tests/sniffly/test_processor_data_verification.py | test_specific_user_commands | TestActualDataVerification | 211 | null |
chiphuyen/sniffly | import json
import os
import tempfile
from datetime import datetime
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from sniffly.share import ShareManager
def temp_dir():
"""Create a temporary directory for testing."""
with tempfile.TemporaryDirectory() as tmpdir:... | "1.5M" | assert | string_literal | tests/sniffly/test_share.py | test_format_number | TestShareManager | 195 | null |
chiphuyen/sniffly | import json
import os
import tempfile
from datetime import datetime
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from sniffly.share import ShareManager
def temp_dir():
"""Create a temporary directory for testing."""
with tempfile.TemporaryDirectory() as tmpdir:... | 24 | assert | numeric_literal | tests/sniffly/test_share.py | test_create_share_link_basic | TestShareManager | 93 | null |
chiphuyen/sniffly | import os
import sys
import unittest
from collections import defaultdict
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sniffly.core.processor import ClaudeLogProcessor
class TestActualDataVerification(unittest.TestCase):
def setUpClass(cls):
"""Set up test data dir... | "Start date should match") | self.assertEqual | string_literal | tests/sniffly/test_processor_data_verification.py | test_date_range | TestActualDataVerification | 188 | null |
chiphuyen/sniffly | import json
import os
import tempfile
from datetime import datetime
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from sniffly.share import ShareManager
def temp_dir():
"""Create a temporary directory for testing."""
with tempfile.TemporaryDirectory() as tmpdir:... | share_id | assert | variable | tests/sniffly/test_share.py | test_create_share_link_public_with_commands | TestShareManager | 136 | null |
chiphuyen/sniffly | import json
import os
import shutil
import sys
import tempfile
import time
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sniffly.core.processor import ClaudeLogProcessor
from sniffly.utils.local_cache import LocalCacheService
from sniffly.utils.memory_cache impor... | "Should process at least 10,000 messages/second") | self.assertGreater | string_literal | tests/sniffly/test_performance.py | test_full_processing_time | TestProcessingPerformance | 84 | null |
chiphuyen/sniffly | import json
import os
import sys
import unittest
from collections import defaultdict
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from sniffly.core.constants import USER_INTERRUPTION_PATTERNS
from sniffly.core.processor import ClaudeLogProcessor
from sniffly.core.s... | 2) | self.assertEqual | numeric_literal | tests/sniffly/core/test_stats.py | test_search_tool_percentage | TestStatisticsCalculations | 754 | null |
chiphuyen/sniffly | import json
import os
from pathlib import Path
from unittest.mock import patch
import pytest
from click.testing import CliRunner
from sniffly.cli import cli
from sniffly.config import Config
class TestCLICommands:
def setup_method(self):
"""Set up test environment."""
self.runner = CliRunner()
... | True | assert | bool_literal | tests/sniffly/test_cli.py | test_config_set_boolean | TestCLICommands | 88 | null |
chiphuyen/sniffly | import json
import os
import tempfile
from datetime import datetime
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from sniffly.share import ShareManager
def temp_dir():
"""Create a temporary directory for testing."""
with tempfile.TemporaryDirectory() as tmpdir:... | temp_dir | assert | variable | tests/sniffly/test_share.py | share_manager | 27 | null | |
chiphuyen/sniffly | import os
import sys
import unittest
from collections import defaultdict
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sniffly.core.processor import ClaudeLogProcessor
class TestActualDataVerification(unittest.TestCase):
def setUpClass(cls):
"""Set up test data dir... | "Should have 1 interruption") | self.assertEqual | string_literal | tests/sniffly/test_processor_data_verification.py | test_user_command_count | TestActualDataVerification | 46 | null |
chiphuyen/sniffly | import json
import os
import sys
import unittest
from collections import defaultdict
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from sniffly.core.constants import USER_INTERRUPTION_PATTERNS
from sniffly.core.processor import ClaudeLogProcessor
from sniffly.core.s... | round(2/3 * 100, 1)) | self.assertEqual | func_call | tests/sniffly/core/test_stats.py | test_search_tool_percentage | TestStatisticsCalculations | 755 | null |
chiphuyen/sniffly | import json
import os
from pathlib import Path
from unittest.mock import patch
import pytest
from click.testing import CliRunner
from sniffly.cli import cli
from sniffly.config import Config
class TestConfig:
def test_parse_integer_values(self):
"""Test integer value parsing."""
cfg = Config()
... | 8081 | assert | numeric_literal | tests/sniffly/test_cli.py | test_parse_integer_values | TestConfig | 210 | null |
chiphuyen/sniffly | import json
import os
import sys
import tempfile
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
from fastapi import HTTPException
from fastapi.testclient import TestClient
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), '..', 'sniff... | "/" | assert | string_literal | tests/sniffly-site/test_admin.py | test_admin_logout | TestAdminAuthEndpoints | 302 | null |
chiphuyen/sniffly | import json
import os
import sys
import tempfile
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
from fastapi import HTTPException
from fastapi.testclient import TestClient
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), '..', 'sniff... | False | assert | bool_literal | tests/sniffly-site/test_admin.py | test_unfeature_project | TestAdminAPIEndpoints | 391 | null |
chiphuyen/sniffly | import logging
from datetime import datetime, timedelta
from unittest.mock import Mock, patch
import pytest
from sniffly.core.global_aggregator import GlobalStatsAggregator
class TestGlobalStatsAggregator:
def mock_caches(self):
"""Create mock cache instances."""
memory_cache = Mock()
fi... | 0.80 | assert | numeric_literal | tests/sniffly/core/test_global_aggregator.py | test_daily_aggregation | TestGlobalStatsAggregator | 186 | null |
chiphuyen/sniffly | import json
import os
import sys
import tempfile
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
from fastapi import HTTPException
from fastapi.testclient import TestClient
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), '..', 'sniff... | 404 | assert | numeric_literal | tests/sniffly-site/test_admin.py | test_feature_project_not_found | TestAdminAPIEndpoints | 363 | null |
chiphuyen/sniffly | import json
import os
import shutil
import sys
import tempfile
import time
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sniffly.core.processor import ClaudeLogProcessor
from sniffly.utils.local_cache import LocalCacheService
from sniffly.utils.memory_cache impor... | "File cache load should be under 500ms") | self.assertLess | string_literal | tests/sniffly/test_performance.py | test_file_cache_performance | TestProcessingPerformance | 263 | null |
chiphuyen/sniffly | import json
import os
import sys
import tempfile
from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
from fastapi import HTTPException
from fastapi.testclient import TestClient
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), '..', 'sniff... | result | assert | variable | tests/sniffly-site/test_admin.py | test_remove_project | TestAdminAPIEndpoints | 420 | null |
chiphuyen/sniffly | import json
import os
import sys
import unittest
from collections import defaultdict
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from sniffly.core.constants import USER_INTERRUPTION_PATTERNS
from sniffly.core.processor import ClaudeLogProcessor
from sniffly.core.s... | 0) | self.assertEqual | numeric_literal | tests/sniffly/core/test_stats.py | test_empty_project | TestEdgeCases | 775 | null |
chiphuyen/sniffly | import json
import os
import tempfile
from datetime import datetime
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from sniffly.share import ShareManager
def temp_dir():
"""Create a temporary directory for testing."""
with tempfile.TemporaryDirectory() as tmpdir:... | "test-logs" | assert | string_literal | tests/sniffly/test_share.py | test_sanitize_statistics | TestShareManager | 183 | null |
meta-llama/synthetic-data-kit | import os
import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from synthetic_data_kit.core.context import AppContext
class TestAppContext:
@patch("synthetic_data_kit.core.context.os.makedirs")
@patch("synthetic_data_kit.core.context.load_config")
def test_ensure_data_d... | len(expected_dirs) | assert | func_call | tests/unit/test_context.py | test_ensure_data_dirs | TestAppContext | 66 | null |
meta-llama/synthetic-data-kit | import pytest
from synthetic_data_kit.utils import llm_processing
@pytest.mark.unit
def test_parse_qa_pairs():
"""Test parsing QA pairs from LLM output."""
# Test with a JSON array containing multiple QA pairs
json_text = """
Here is the result:
[
{
"question": "What is synthet... | 3 | assert | numeric_literal | tests/unit/test_llm_processing.py | test_parse_qa_pairs | 33 | null | |
meta-llama/synthetic-data-kit | import pytest
from synthetic_data_kit.utils import llm_processing
@pytest.mark.unit
def test_convert_to_conversation_format():
"""Test converting QA pairs to conversation format."""
qa_pairs = [
{
"question": "What is synthetic data?",
"answer": "Synthetic data is artificially ... | "system" | assert | string_literal | tests/unit/test_llm_processing.py | test_convert_to_conversation_format | 79 | null | |
meta-llama/synthetic-data-kit | import os
import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from synthetic_data_kit.core.context import AppContext
class TestAppContext:
def test_multiple_instances_independent(self):
"""Test that multiple AppContext instances are independent"""
with patch.ob... | context2.config_path | assert | complex_expr | tests/unit/test_context.py | test_multiple_instances_independent | TestAppContext | 138 | null |
meta-llama/synthetic-data-kit | import json
from unittest.mock import MagicMock
import pytest
from synthetic_data_kit.generators.qa_generator import QAGenerator
@pytest.mark.unit
def test_generate_qa_pairs(patch_config):
"""Test generating QA pairs."""
# Create mock LLM client
mock_client = MagicMock()
mock_client.batch_completion.... | "What is synthetic data?" | assert | string_literal | tests/unit/test_qa_generator.py | test_generate_qa_pairs | 82 | null | |
meta-llama/synthetic-data-kit | import os
import tempfile
import json
from typing import Dict, List, Tuple, Optional, Any
from pathlib import Path
from unittest.mock import patch
class DirectoryStatsHelper:
@staticmethod
def assert_directory_stats(stats: Dict[str, Any],
expected_total: int,
... | expected_total | assert | variable | tests/utils/test_helpers.py | assert_directory_stats | DirectoryStatsHelper | 96 | null |
meta-llama/synthetic-data-kit | import os
import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from synthetic_data_kit.core.context import AppContext
class TestAppContext:
@patch("synthetic_data_kit.core.context.os.makedirs")
@patch("synthetic_data_kit.core.context.load_config")
def test_ensure_data_d... | OSError, match="Permission denied") | pytest.raises | complex_expr | tests/unit/test_context.py | test_ensure_data_dirs_exception_handling | TestAppContext | 172 | null |
meta-llama/synthetic-data-kit | from pathlib import Path
import pytest
from synthetic_data_kit.utils import config, text
@pytest.mark.unit
def test_get_path_config():
"""Test getting path configuration."""
# Create a test config with proper structure
test_config = {
"paths": {
"output": {"default": "data/output", "g... | "data/output" | assert | string_literal | tests/unit/test_utils.py | test_get_path_config | 142 | null | |
meta-llama/synthetic-data-kit | import os
import tempfile
import json
from unittest.mock import patch, MagicMock
import pytest
@pytest.mark.integration
def test_single_file_error_handling_unchanged():
"""Test that single file error handling works as before."""
# Test with non-existent file by calling the CLI function directly
from synth... | 1 | assert | numeric_literal | tests/integration/test_backward_compatibility.py | test_single_file_error_handling_unchanged | 216 | null | |
meta-llama/synthetic-data-kit | import os
import tempfile
from unittest.mock import MagicMock, patch
import pytest
from synthetic_data_kit.parsers.html_parser import HTMLParser
from synthetic_data_kit.parsers.pdf_parser import PDFParser
from synthetic_data_kit.parsers.txt_parser import TXTParser
@pytest.mark.unit
def test_pdf_parser():
"""Test... | "This is sample PDF content for testing." | assert | string_literal | tests/unit/test_parsers.py | test_pdf_parser | 142 | null | |
meta-llama/synthetic-data-kit | import os
import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from synthetic_data_kit.core.context import AppContext
class TestAppContext:
def test_config_attribute_mutable(self):
"""Test that config attribute can be modified"""
with patch.object(AppContext, "_... | "inner_value" | assert | string_literal | tests/unit/test_context.py | test_config_attribute_mutable | TestAppContext | 129 | null |
meta-llama/synthetic-data-kit | from pathlib import Path
import pytest
from synthetic_data_kit.utils import config, text
@pytest.mark.unit
def test_split_into_chunks():
"""Test splitting text into chunks."""
# Create multi-paragraph text
paragraphs = ["Paragraph one." * 5, "Paragraph two." * 5, "Paragraph three." * 5]
text_content ... | 0 | assert | numeric_literal | tests/unit/test_utils.py | test_split_into_chunks | 21 | null | |
meta-llama/synthetic-data-kit | import os
import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from synthetic_data_kit.core.context import AppContext
class TestAppContext:
def test_multiple_instances_independent(self):
"""Test that multiple AppContext instances are independent"""
with patch.ob... | context2.config | assert | complex_expr | tests/unit/test_context.py | test_multiple_instances_independent | TestAppContext | 145 | null |
meta-llama/synthetic-data-kit | import json
from unittest.mock import MagicMock
import pytest
from synthetic_data_kit.generators.qa_generator import QAGenerator
@pytest.mark.unit
def test_generate_summary(patch_config):
"""Test generating summary."""
# Create mock LLM client
mock_client = MagicMock()
mock_client.chat_completion.ret... | "This is a summary of the document." | assert | string_literal | tests/unit/test_qa_generator.py | test_generate_summary | 41 | null | |
meta-llama/synthetic-data-kit | import json
from unittest.mock import MagicMock
import pytest
from synthetic_data_kit.generators.cot_generator import COTGenerator
@pytest.mark.unit
def test_enhance_with_cot(patch_config):
"""Test enhancing existing conversations with COT reasoning."""
# Create mock LLM client with config
mock_client = ... | "system" | assert | string_literal | tests/unit/test_cot_generator.py | test_enhance_with_cot | 204 | null | |
meta-llama/synthetic-data-kit | import os
import tempfile
import json
from unittest.mock import patch, MagicMock
import pytest
from synthetic_data_kit.utils.directory_processor import (
process_directory_ingest,
process_directory_save_as,
get_directory_stats,
INGEST_EXTENSIONS,
SAVE_AS_EXTENSIONS
)
@pytest.mark.integration
def ... | 2 | assert | numeric_literal | tests/integration/test_directory_edge_cases.py | test_directory_stats_functionality | 109 | null | |
meta-llama/synthetic-data-kit | import json
import os
import tempfile
from unittest.mock import MagicMock, patch
import pytest
from synthetic_data_kit.core import create, ingest, save_as
from synthetic_data_kit.parsers.txt_parser import TXTParser
@pytest.mark.integration
def test_complete_workflow(patch_config, test_env):
"""Test the complete ... | "What is the document about?" | assert | string_literal | tests/integration/test_end_to_end_workflow.py | test_complete_workflow | 162 | null | |
meta-llama/synthetic-data-kit | import os
import tempfile
from unittest.mock import MagicMock, patch
import pytest
from synthetic_data_kit.parsers.html_parser import HTMLParser
from synthetic_data_kit.parsers.pdf_parser import PDFParser
from synthetic_data_kit.parsers.txt_parser import TXTParser
@pytest.mark.unit
def test_html_parser():
"""Tes... | content | assert | variable | tests/unit/test_parsers.py | test_html_parser | 102 | null | |
meta-llama/synthetic-data-kit | from unittest.mock import MagicMock, patch
import pytest
from synthetic_data_kit.models.llm_client import LLMClient
@pytest.mark.unit
def test_llm_client_initialization(patch_config, test_env):
"""Test LLM client initialization with API endpoint provider."""
with patch("synthetic_data_kit.models.llm_client.O... | "api-endpoint" | assert | string_literal | tests/unit/test_llm_client.py | test_llm_client_initialization | 21 | null | |
meta-llama/synthetic-data-kit | import pytest
from synthetic_data_kit.utils import llm_processing
@pytest.mark.unit
def test_parse_qa_pairs():
"""Test parsing QA pairs from LLM output."""
# Test with a JSON array containing multiple QA pairs
json_text = """
Here is the result:
[
{
"question": "What is synthet... | "How can synthetic data help with ML?" | assert | string_literal | tests/unit/test_llm_processing.py | test_parse_qa_pairs | 36 | null | |
meta-llama/synthetic-data-kit | from pathlib import Path
import pytest
from synthetic_data_kit.utils import config, text
@pytest.mark.unit
def test_load_config(tmpdir):
"""Test loading config from file."""
# Create a temporary config file
config_path = Path(tmpdir) / "test_config.yaml"
with open(config_path, "w") as f:
f.w... | "test-model" | assert | string_literal | tests/unit/test_utils.py | test_load_config | 114 | null | |
meta-llama/synthetic-data-kit | from pathlib import Path
import pytest
from synthetic_data_kit.utils import config, text
@pytest.mark.unit
def test_extract_json_from_text():
"""Test extracting JSON from text."""
# Test valid JSON in code block
json_text = """
Some random text before the JSON
```json
{
"question": "W... | result | assert | variable | tests/unit/test_utils.py | test_extract_json_from_text | 55 | null | |
meta-llama/synthetic-data-kit | import os
import tempfile
from unittest.mock import MagicMock, patch
import pytest
from synthetic_data_kit.parsers.html_parser import HTMLParser
from synthetic_data_kit.parsers.pdf_parser import PDFParser
from synthetic_data_kit.parsers.txt_parser import TXTParser
@pytest.mark.unit
def test_txt_parser():
"""Test... | [{"text": "This is sample text content for testing."}] | assert | collection | tests/unit/test_parsers.py | test_txt_parser | 30 | null | |
meta-llama/synthetic-data-kit | import json
import os
import tempfile
from unittest.mock import patch
import pytest
from synthetic_data_kit.core import save_as
@pytest.mark.integration
def test_convert_format_with_filtered_pairs():
"""Test converting filtered_pairs to different formats."""
# Create sample QA pairs with ratings
filtered... | "user" | assert | string_literal | tests/integration/test_save_as_flow.py | test_convert_format_with_filtered_pairs | 147 | null | |
meta-llama/synthetic-data-kit | import json
from unittest.mock import MagicMock
import pytest
from synthetic_data_kit.generators.qa_generator import QAGenerator
@pytest.mark.unit
def test_qa_generator_initialization(patch_config):
"""Test QA generator initialization."""
# Create mock LLM client
mock_client = MagicMock()
# Initiali... | None | assert | none_literal | tests/unit/test_qa_generator.py | test_qa_generator_initialization | 22 | null | |
meta-llama/synthetic-data-kit | import json
import os
import tempfile
from unittest.mock import patch
import pytest
from synthetic_data_kit.core import create, curate, save_as
from synthetic_data_kit.models.llm_client import LLMClient
from synthetic_data_kit.utils.llm_processing import parse_qa_pairs
@pytest.mark.unit
def test_parse_qa_pairs_inval... | result[0] | assert | complex_expr | tests/unit/test_error_handling.py | test_parse_qa_pairs_invalid_json | 38 | null | |
meta-llama/synthetic-data-kit | import json
from unittest.mock import MagicMock
import pytest
from synthetic_data_kit.generators.cot_generator import COTGenerator
@pytest.mark.unit
def test_cot_generator_initialization(patch_config):
"""Test COT generator initialization."""
# Create mock LLM client
mock_client = MagicMock()
# Init... | None | assert | none_literal | tests/unit/test_cot_generator.py | test_cot_generator_initialization | 22 | null | |
meta-llama/synthetic-data-kit | from unittest.mock import MagicMock, patch
import pytest
from synthetic_data_kit.models.llm_client import LLMClient
@pytest.mark.unit
def test_llm_client_chat_completion(patch_config, test_env):
"""Test LLM client chat completion with API endpoint provider."""
with patch("synthetic_data_kit.models.llm_client... | "This is a test response" | assert | string_literal | tests/unit/test_llm_client.py | test_llm_client_chat_completion | 88 | null | |
meta-llama/synthetic-data-kit | import json
import os
import tempfile
from unittest.mock import patch
import pytest
from synthetic_data_kit.core import save_as
@pytest.mark.integration
def test_convert_format():
"""Test converting QA pairs to different formats."""
# Create sample QA pairs
qa_pairs = [
{
"question": ... | 2 | assert | numeric_literal | tests/integration/test_save_as_flow.py | test_convert_format | 51 | null | |
meta-llama/synthetic-data-kit | import json
from unittest.mock import MagicMock
import pytest
from synthetic_data_kit.generators.qa_generator import QAGenerator
@pytest.mark.unit
def test_qa_generator_initialization(patch_config):
"""Test QA generator initialization."""
# Create mock LLM client
mock_client = MagicMock()
# Initiali... | mock_client | assert | variable | tests/unit/test_qa_generator.py | test_qa_generator_initialization | 21 | null | |
meta-llama/synthetic-data-kit | import pytest
from synthetic_data_kit.utils import llm_processing
@pytest.mark.unit
def test_convert_to_conversation_format():
"""Test converting QA pairs to conversation format."""
qa_pairs = [
{
"question": "What is synthetic data?",
"answer": "Synthetic data is artificially ... | "assistant" | assert | string_literal | tests/unit/test_llm_processing.py | test_convert_to_conversation_format | 82 | null | |
meta-llama/synthetic-data-kit | import os
import tempfile
import json
from typing import Dict, List, Tuple, Optional, Any
from pathlib import Path
from unittest.mock import patch
class DirectoryStatsHelper:
@staticmethod
def assert_directory_stats(stats: Dict[str, Any],
expected_total: int,
... | expected_unsupported | assert | variable | tests/utils/test_helpers.py | assert_directory_stats | DirectoryStatsHelper | 103 | null |
meta-llama/synthetic-data-kit | import os
import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from synthetic_data_kit.core.context import AppContext
class TestAppContext:
def test_config_path_type_handling(self):
"""Test that config_path handles different path types correctly"""
with patch.ob... | string_path | assert | variable | tests/unit/test_context.py | test_config_path_type_handling | TestAppContext | 181 | null |
meta-llama/synthetic-data-kit | import json
import os
import tempfile
from unittest.mock import MagicMock, patch
import pytest
from synthetic_data_kit.core import create, ingest, save_as
from synthetic_data_kit.parsers.txt_parser import TXTParser
@pytest.mark.integration
def test_complete_workflow(patch_config, test_env):
"""Test the complete ... | final_path | assert | variable | tests/integration/test_end_to_end_workflow.py | test_complete_workflow | 150 | null | |
meta-llama/synthetic-data-kit | from pathlib import Path
import pytest
from synthetic_data_kit.utils import config, text
@pytest.mark.unit
def test_extract_json_from_text():
"""Test extracting JSON from text."""
# Test valid JSON in code block
json_text = """
Some random text before the JSON
```json
{
"question": "W... | "What is synthetic data?" | assert | string_literal | tests/unit/test_utils.py | test_extract_json_from_text | 56 | null | |
meta-llama/synthetic-data-kit | import os
import tempfile
import json
from unittest.mock import patch, MagicMock
import pytest
@pytest.mark.integration
def test_single_file_ingest_still_works(patch_config):
"""Test that single file ingest processing works unchanged."""
with tempfile.NamedTemporaryFile(mode="w", suffix=".txt", delete=False) ... | input_file | assert | variable | tests/integration/test_backward_compatibility.py | test_single_file_ingest_still_works | 40 | null | |
meta-llama/synthetic-data-kit | import json
import os
import tempfile
from unittest.mock import patch
import pytest
from synthetic_data_kit.core import save_as
@pytest.mark.integration
def test_convert_format_with_filtered_pairs():
"""Test converting filtered_pairs to different formats."""
# Create sample QA pairs with ratings
filtered... | 3 | assert | numeric_literal | tests/integration/test_save_as_flow.py | test_convert_format_with_filtered_pairs | 143 | null | |
meta-llama/synthetic-data-kit | import json
import os
import tempfile
from unittest.mock import MagicMock, patch
import pytest
from synthetic_data_kit.core import create, ingest, save_as
from synthetic_data_kit.parsers.txt_parser import TXTParser
@pytest.mark.integration
def test_complete_workflow(patch_config, test_env):
"""Test the complete ... | 1 | assert | numeric_literal | tests/integration/test_end_to_end_workflow.py | test_complete_workflow | 158 | null | |
meta-llama/synthetic-data-kit | import os
import tempfile
import json
from unittest.mock import patch, MagicMock
import pytest
@pytest.mark.integration
def test_single_file_ingest_still_works(patch_config):
"""Test that single file ingest processing works unchanged."""
with tempfile.NamedTemporaryFile(mode="w", suffix=".txt", delete=False) ... | result.stdout | assert | complex_expr | tests/integration/test_backward_compatibility.py | test_single_file_ingest_still_works | 35 | null | |
meta-llama/synthetic-data-kit | from pathlib import Path
import pytest
from synthetic_data_kit.utils import config, text
@pytest.mark.unit
def test_split_into_chunks():
"""Test splitting text into chunks."""
# Create multi-paragraph text
paragraphs = ["Paragraph one." * 5, "Paragraph two." * 5, "Paragraph three." * 5]
text_content ... | [] | assert | collection | tests/unit/test_utils.py | test_split_into_chunks | 34 | null | |
meta-llama/synthetic-data-kit | import pytest
from synthetic_data_kit.utils import llm_processing
@pytest.mark.unit
def test_parse_qa_pairs_with_regex():
"""Test parsing QA pairs using regex fallback."""
# Test with a non-JSON format that requires regex pattern matching
# Format the text exactly as the regex pattern expects
text = "... | 2 | assert | numeric_literal | tests/unit/test_llm_processing.py | test_parse_qa_pairs_with_regex | 53 | null | |
meta-llama/synthetic-data-kit | import os
import shutil
import subprocess
import pytest
import requests
import lance
PDF_URL = "https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611_sample_explain.pdf"
PDF_FILENAME = "sample_multimodal.pdf"
OUTPUT_DIR = "test_output"
def setup_module():
"""Download the test PDF and creat... | schema.names | assert | complex_expr | tests/functional/test_multimodal.py | test_ingest_pdf_default | 51 | null | |
meta-llama/synthetic-data-kit | import json
import os
import tempfile
from unittest.mock import MagicMock, patch
import pytest
from synthetic_data_kit.utils.format_converter import (
to_alpaca,
to_chatml,
to_fine_tuning,
to_hf_dataset,
to_jsonl,
)
@pytest.mark.unit
def test_to_fine_tuning():
"""Test conversion to fine-tunin... | 3 | assert | numeric_literal | tests/unit/test_format_converter.py | test_to_fine_tuning | 157 | null | |
meta-llama/synthetic-data-kit | import json
from unittest.mock import MagicMock
import pytest
from synthetic_data_kit.generators.cot_generator import COTGenerator
@pytest.mark.unit
def test_parse_json_output():
"""Test parsing JSON output from LLM."""
# Create mock LLM client
mock_client = MagicMock()
# Initialize generator
ge... | result[0] | assert | complex_expr | tests/unit/test_cot_generator.py | test_parse_json_output | 58 | null | |
meta-llama/synthetic-data-kit | import os
import tempfile
from unittest.mock import MagicMock, patch
import pytest
from synthetic_data_kit.parsers.docx_parser import DOCXParser
from synthetic_data_kit.parsers.ppt_parser import PPTParser
from synthetic_data_kit.parsers.youtube_parser import YouTubeParser
class TestPPTParser:
@patch("builtins._... | "/fake/path.pptx") | assert_* | string_literal | tests/unit/test_additional_parsers.py | test_ppt_parse_success | TestPPTParser | 152 | null |
meta-llama/synthetic-data-kit | import os
import tempfile
import json
from unittest.mock import patch
import pytest
@pytest.mark.functional
def test_create_preview_mode(patch_config):
"""Test create command with --preview flag."""
temp_dir = tempfile.mkdtemp()
try:
# Create test .txt files for create command
txt_fil... | result.stdout | assert | complex_expr | tests/functional/test_preview_mode.py | test_create_preview_mode | 74 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.