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 |
|---|---|---|---|---|---|---|---|---|---|
mohamed-chs/convoviz | from pathlib import Path
from convoviz.io.assets import build_asset_index, copy_asset, resolve_asset_path
class TestCopyAsset:
def test_basic_copy(self, tmp_path: Path) -> None:
"""Test copying an asset to the destination."""
src_file = tmp_path / "source.png"
src_file.write_bytes(b"PNG d... | "assets/source.png" | assert | string_literal | tests/test_assets.py | test_basic_copy | TestCopyAsset | 106 | null |
mohamed-chs/convoviz | from convoviz.exceptions import (
ConfigurationError,
ConvovizError,
InvalidZipError,
MessageContentError,
)
class TestInvalidZipError:
def test_message_format(self) -> None:
"""Test error message format."""
error = InvalidZipError("/path/to/file.zip")
assert "/path/to/fil... | str(error) | assert | func_call | tests/test_exceptions.py | test_message_format | TestInvalidZipError | 25 | null |
mohamed-chs/convoviz | from pathlib import Path
import pytest
from convoviz.exceptions import ConfigurationError
from convoviz.utils import (
deep_merge_dicts,
expand_path,
normalize_optional_path,
sanitize,
validate_header,
validate_writable_dir,
)
class TestSanitize:
def test_sanitize_strips_ends(self) -> No... | "Hello" | assert | string_literal | tests/test_utils.py | test_sanitize_strips_ends | TestSanitize | 56 | null |
mohamed-chs/convoviz | from datetime import datetime
from convoviz.config import YAMLConfig
from convoviz.models import Conversation
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
from convoviz.renderers.markdown import replace_citations
from convoviz.renderers.yaml import re... | ["[^1]: [S1](http://s1.com)"] | assert | collection | tests/test_v3_spec.py | test_replace_embedded_citations_reuses_footnote_numbers | TestCitationParsing | 161 | null |
mohamed-chs/convoviz | from datetime import datetime, timedelta
from convoviz.config import AuthorHeaders, ConversationConfig, YAMLConfig
from convoviz.models import Conversation, Node
from convoviz.renderers import render_conversation
from convoviz.renderers.markdown import (
close_code_blocks,
render_message_header,
render_nod... | rendered | assert | variable | tests/test_renderers.py | test_render_node_respects_explicit_empty_citation_map | 429 | null | |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from convoviz.config import (
AuthorHeaders,
ConversationConfig,
FolderOrganization,
YAMLConfig,
)
from convoviz.io.writers import get_date_folder_path, save_collection, save_conversation
from convoviz.models import Conversation, ConversationC... | filepath | assert | variable | tests/test_writers.py | test_save_creates_file | TestSaveConversation | 424 | null |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from convoviz.config import (
AuthorHeaders,
ConversationConfig,
FolderOrganization,
YAMLConfig,
)
from convoviz.io.writers import get_date_folder_path, save_collection, save_conversation
from convoviz.models import Conversation, ConversationC... | Path("2024/03-March") | assert | func_call | tests/test_writers.py | test_march | TestGetDateFolderPath | 87 | null |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from convoviz.config import (
AuthorHeaders,
ConversationConfig,
FolderOrganization,
YAMLConfig,
)
from convoviz.io.writers import get_date_folder_path, save_collection, save_conversation
from convoviz.models import Conversation, ConversationC... | Path("2023/06-June") | assert | func_call | tests/test_writers.py | test_different_years | TestGetDateFolderPath | 111 | null |
mohamed-chs/convoviz | from datetime import datetime
from convoviz.config import YAMLConfig
from convoviz.models import Conversation
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
from convoviz.renderers.markdown import replace_citations
from convoviz.renderers.yaml import re... | "This is a claim [^1] and another [^2]." | assert | string_literal | tests/test_v3_spec.py | test_replace_citations | TestCitationParsing | 117 | null |
mohamed-chs/convoviz | from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from convoviz.config import OutputKind, get_default_config
from convoviz.interactive import run_interactive_config
def test_outputs_prompt_respects_existing_config(
monkeypatch: pytest.MonkeyPatch,
) -> None:
"""Test that the ... | True | assert | bool_literal | tests/test_interactive.py | test_outputs_prompt_respects_existing_config | 277 | null | |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from unittest.mock import patch
import pytest
from convoviz.analysis.wordcloud import (
_generate_and_save_wordcloud,
generate_wordcloud,
generate_wordclouds,
load_nltk_stopwords,
parse_custom_stopwords,
)
from convoviz.config import Word... | config.random_state | assert | complex_expr | tests/test_wordcloud.py | test_generate_wordcloud_no_programming_stopwords | 54 | null | |
mohamed-chs/convoviz | from pathlib import Path
from unittest.mock import patch
import pytest
from typer.testing import CliRunner
from convoviz.cli import app
from convoviz.config import OutputKind
runner = CliRunner()
def _isolate_user_config(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
monkeypatch.setattr(
"con... | 0 | assert | numeric_literal | tests/test_cli.py | test_config_init_writes_default | 174 | null | |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from convoviz.io.canvas import get_extension, save_canvas_documents
from convoviz.models import Conversation, ConversationCollection
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
def test_con... | "test_doc" | assert | string_literal | tests/test_canvas.py | test_conversation_canvas_documents | 91 | null | |
mohamed-chs/convoviz | from datetime import datetime
from convoviz.config import YAMLConfig
from convoviz.models import Conversation
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
from convoviz.renderers.markdown import replace_citations
from convoviz.renderers.yaml import re... | rendered_text | assert | variable | tests/test_v3_spec.py | test_replace_citations | TestCitationParsing | 122 | null |
mohamed-chs/convoviz | from pathlib import Path
import pytest
from convoviz.config import (
ALL_OUTPUTS,
AuthorHeaders,
ConversationConfig,
ConvovizConfig,
GraphConfig,
MarkdownConfig,
MessageConfig,
OutputKind,
WordCloudConfig,
YAMLConfig,
apply_runtime_defaults,
get_default_config,
get_... | False | assert | bool_literal | tests/test_config.py | test_apply_runtime_defaults_preserves_existing_input | 63 | null | |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from unittest.mock import patch
import pytest
from convoviz.analysis.wordcloud import (
_generate_and_save_wordcloud,
generate_wordcloud,
generate_wordclouds,
load_nltk_stopwords,
parse_custom_stopwords,
)
from convoviz.config import Word... | random_state | assert | variable | tests/test_wordcloud.py | test_wordcloud_config_random_state | 165 | null | |
mohamed-chs/convoviz | from convoviz.exceptions import (
ConfigurationError,
ConvovizError,
InvalidZipError,
MessageContentError,
)
class TestInvalidZipError:
def test_attributes(self) -> None:
"""Test error attributes."""
error = InvalidZipError("/path/to/file.zip", reason="test")
assert error.... | "/path/to/file.zip" | assert | string_literal | tests/test_exceptions.py | test_attributes | TestInvalidZipError | 36 | null |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from convoviz.io.canvas import get_extension, save_canvas_documents
from convoviz.models import Conversation, ConversationCollection
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
def test_can... | None | assert | none_literal | tests/test_canvas.py | test_canvas_document_extraction | 41 | null | |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from unittest.mock import patch
import pytest
from convoviz.analysis.wordcloud import (
_generate_and_save_wordcloud,
generate_wordcloud,
generate_wordclouds,
load_nltk_stopwords,
parse_custom_stopwords,
)
from convoviz.config import Word... | 0 | assert | numeric_literal | tests/test_wordcloud.py | test_load_nltk_stopwords | 24 | null | |
mohamed-chs/convoviz | import logging
from pathlib import Path
from convoviz.logging_config import setup_logging
def _cleanup_convoviz_handlers() -> None:
root_logger = logging.getLogger()
for handler in list(root_logger.handlers):
if getattr(handler, "_convoviz_handler", False):
root_logger.removeHandler(handle... | 2 | assert | numeric_literal | tests/test_logging_config.py | test_setup_logging_replaces_handlers | 40 | null | |
mohamed-chs/convoviz | import json
import stat
import time
from pathlib import Path
from zipfile import ZipFile, ZipInfo
import orjson
import pytest
from convoviz.exceptions import InvalidZipError
from convoviz.io.loaders import (
find_latest_valid_zip,
find_script_export,
load_collection,
load_collection_from_json,
loa... | None | assert | none_literal | tests/test_loaders.py | test_returns_none_when_no_valid_zips | TestFindLatestValidZip | 202 | null |
mohamed-chs/convoviz | from pathlib import Path
from convoviz.io.assets import build_asset_index, copy_asset, resolve_asset_path
class TestBuildAssetIndex:
def test_build_asset_index_prefix_maps(self, tmp_path: Path) -> None:
(tmp_path / "file-123-extra.png").touch()
(tmp_path / "file-123.png").touch()
dalle_di... | index.dalle_prefix_map | assert | complex_expr | tests/test_assets.py | test_build_asset_index_prefix_maps | TestBuildAssetIndex | 177 | null |
mohamed-chs/convoviz | from pathlib import Path
import pytest
from convoviz.config import (
ALL_OUTPUTS,
AuthorHeaders,
ConversationConfig,
ConvovizConfig,
GraphConfig,
MarkdownConfig,
MessageConfig,
OutputKind,
WordCloudConfig,
YAMLConfig,
apply_runtime_defaults,
get_default_config,
get_... | "RGBA" | assert | string_literal | tests/test_config.py | test_wordcloud_config_defaults | 105 | null | |
mohamed-chs/convoviz | from pathlib import Path
import pytest
from convoviz.config import (
ALL_OUTPUTS,
AuthorHeaders,
ConversationConfig,
ConvovizConfig,
GraphConfig,
MarkdownConfig,
MessageConfig,
OutputKind,
WordCloudConfig,
YAMLConfig,
apply_runtime_defaults,
get_default_config,
get_... | existing | assert | variable | tests/test_config.py | test_apply_runtime_defaults_preserves_existing_input | 64 | null | |
mohamed-chs/convoviz | from datetime import UTC, datetime
from convoviz.config import AuthorHeaders, ConversationConfig, MarkdownConfig
from convoviz.models import Conversation
from convoviz.renderers.markdown import render_conversation, render_obsidian_callout
class TestObsidianCallout:
def test_multiline_content(self) -> None:
... | result | assert | variable | tests/test_markdown_flavors.py | test_multiline_content | TestObsidianCallout | 71 | null |
mohamed-chs/convoviz | from datetime import datetime, timedelta
from convoviz.config import AuthorHeaders, ConversationConfig, YAMLConfig
from convoviz.models import Conversation, Node
from convoviz.renderers import render_conversation
from convoviz.renderers.markdown import (
close_code_blocks,
render_message_header,
render_nod... | "$x^2$" | assert | string_literal | tests/test_renderers.py | test_inline_delimiters | TestReplaceLatexDelimiters | 72 | null |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from convoviz.io.canvas import get_extension, save_canvas_documents
from convoviz.models import Conversation, ConversationCollection
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
def test_get... | ".txt" | assert | string_literal | tests/test_canvas.py | test_get_extension_defaults | 205 | null | |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from convoviz.io.canvas import get_extension, save_canvas_documents
from convoviz.models import Conversation, ConversationCollection
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
def test_can... | "print(123)" | assert | string_literal | tests/test_canvas.py | test_canvas_json_string_in_parts | 170 | null | |
mohamed-chs/convoviz | from pathlib import Path
from unittest.mock import patch
import pytest
from typer.testing import CliRunner
from convoviz.cli import app
from convoviz.config import OutputKind
runner = CliRunner()
def _isolate_user_config(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
monkeypatch.setattr(
"con... | {OutputKind.MARKDOWN} | assert | collection | tests/test_cli.py | test_outputs_flag_single | 101 | null | |
mohamed-chs/convoviz | from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from convoviz.config import OutputKind, get_default_config
from convoviz.interactive import run_interactive_config
def test_script_export_merge_prompt(
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,
) -> None:
"""Test th... | export_path | assert | variable | tests/test_interactive.py | test_script_export_merge_prompt | 316 | null | |
mohamed-chs/convoviz | import json
from pathlib import Path
from unittest.mock import patch
import pytest
from convoviz.config import OutputKind, get_default_config
from convoviz.exceptions import ConfigurationError, InvalidZipError
from convoviz.pipeline import run_pipeline
def test_run_pipeline_additive_output(mock_zip_file: Path, tmp_p... | "keep me" | assert | string_literal | tests/test_pipeline.py | test_run_pipeline_additive_output | 154 | null | |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from unittest.mock import patch
import pytest
from convoviz.analysis.wordcloud import (
_generate_and_save_wordcloud,
generate_wordcloud,
generate_wordclouds,
load_nltk_stopwords,
parse_custom_stopwords,
)
from convoviz.config import Word... | False | assert | bool_literal | tests/test_wordcloud.py | test_generate_and_save_wordcloud_skips_empty_text | 61 | null | |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from unittest.mock import patch
import pytest
from convoviz.analysis.wordcloud import (
_generate_and_save_wordcloud,
generate_wordcloud,
generate_wordclouds,
load_nltk_stopwords,
parse_custom_stopwords,
)
from convoviz.config import Word... | passed_stopwords | assert | variable | tests/test_wordcloud.py | test_generate_wordcloud_no_programming_stopwords | 50 | null | |
mohamed-chs/convoviz | from datetime import datetime
from convoviz.config import YAMLConfig
from convoviz.models import Conversation
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
from convoviz.renderers.markdown import replace_citations
from convoviz.renderers.yaml import re... | ["[^1]: [Source 1](http://example.com/1)"] | assert | collection | tests/test_v3_spec.py | test_replace_citations_obsidian_format | TestCitationParsing | 175 | null |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from convoviz.config import (
AuthorHeaders,
ConversationConfig,
FolderOrganization,
YAMLConfig,
)
from convoviz.io.writers import get_date_folder_path, save_collection, save_conversation
from convoviz.models import Conversation, ConversationC... | Path("2024/06-June") | assert | func_call | tests/test_writers.py | test_different_years | TestGetDateFolderPath | 112 | null |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from unittest.mock import patch
import pytest
from convoviz.analysis.wordcloud import (
_generate_and_save_wordcloud,
generate_wordcloud,
generate_wordclouds,
load_nltk_stopwords,
parse_custom_stopwords,
)
from convoviz.config import Word... | max_workers | assert | variable | tests/test_wordcloud.py | test_wordcloud_config_max_workers | 158 | null | |
mohamed-chs/convoviz | from pathlib import Path
from convoviz.io.assets import build_asset_index, copy_asset, resolve_asset_path
class TestResolveAssetPath:
def test_user_folder_multiple_users(self, tmp_path: Path) -> None:
"""Test finding asset when multiple user-* folders exist."""
user_dir_1 = tmp_path / "user-111"
... | "target-asset.png" | assert | string_literal | tests/test_assets.py | test_user_folder_multiple_users | TestResolveAssetPath | 53 | null |
mohamed-chs/convoviz | import io
from zipfile import ZipFile
import pytest
from convoviz.config import ConvovizConfig
from convoviz.exceptions import InvalidZipError
from convoviz.io.loaders import extract_archive
from convoviz.pipeline import run_pipeline
from convoviz.utils import sanitize
def test_safe_directory_management(tmp_path):
... | "I should stay" | assert | string_literal | tests/test_security.py | test_safe_directory_management | 78 | null | |
mohamed-chs/convoviz | from pathlib import Path
import pytest
from convoviz.exceptions import ConfigurationError
from convoviz.utils import (
deep_merge_dicts,
expand_path,
normalize_optional_path,
sanitize,
validate_header,
validate_writable_dir,
)
class TestSanitize:
def test_sanitize_transliterates_accents(... | "Moron" | assert | string_literal | tests/test_utils.py | test_sanitize_transliterates_accents | TestSanitize | 68 | null |
mohamed-chs/convoviz | import json
from pathlib import Path
from unittest.mock import patch
import pytest
from convoviz.config import OutputKind, get_default_config
from convoviz.exceptions import ConfigurationError, InvalidZipError
from convoviz.pipeline import run_pipeline
def test_run_pipeline_missing_graph_dependency(
mock_zip_fil... | ConfigurationError) | pytest.raises | variable | tests/test_pipeline.py | test_run_pipeline_missing_graph_dependency | 264 | null | |
mohamed-chs/convoviz | from pathlib import Path
import pytest
from convoviz.config import (
ALL_OUTPUTS,
AuthorHeaders,
ConversationConfig,
ConvovizConfig,
GraphConfig,
MarkdownConfig,
MessageConfig,
OutputKind,
WordCloudConfig,
YAMLConfig,
apply_runtime_defaults,
get_default_config,
get_... | "flat" | assert | string_literal | tests/test_config.py | test_load_config_from_path_overrides_defaults | 180 | null | |
mohamed-chs/convoviz | from datetime import datetime
from convoviz.config import YAMLConfig
from convoviz.models import Conversation
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
from convoviz.renderers.markdown import replace_citations
from convoviz.renderers.yaml import re... | text | assert | variable | tests/test_v3_spec.py | test_replace_citations_out_of_bounds_ignored | TestCitationParsing | 188 | null |
mohamed-chs/convoviz | import io
from zipfile import ZipFile
import pytest
from convoviz.config import ConvovizConfig
from convoviz.exceptions import InvalidZipError
from convoviz.io.loaders import extract_archive
from convoviz.pipeline import run_pipeline
from convoviz.utils import sanitize
def test_sanitize_reserved_names():
assert ... | "_aux_" | assert | string_literal | tests/test_security.py | test_sanitize_reserved_names | 50 | null | |
mohamed-chs/convoviz | from pathlib import Path
from convoviz.io.assets import build_asset_index, copy_asset, resolve_asset_path
class TestCopyAsset:
def test_reuses_existing_when_identical(self, tmp_path: Path) -> None:
src_file = tmp_path / "image.png"
src_file.write_bytes(b"SAME")
dest_dir = tmp_path / "out... | "assets/image.png" | assert | string_literal | tests/test_assets.py | test_reuses_existing_when_identical | TestCopyAsset | 153 | null |
mohamed-chs/convoviz | import json
from pathlib import Path
from unittest.mock import patch
import pytest
from convoviz.config import OutputKind, get_default_config
from convoviz.exceptions import ConfigurationError, InvalidZipError
from convoviz.pipeline import run_pipeline
def test_run_pipeline_invalid_zip(tmp_path: Path) -> None:
"... | InvalidZipError) | pytest.raises | variable | tests/test_pipeline.py | test_run_pipeline_invalid_zip | 56 | null | |
mohamed-chs/convoviz | from pathlib import Path
import pytest
from convoviz.config import (
ALL_OUTPUTS,
AuthorHeaders,
ConversationConfig,
ConvovizConfig,
GraphConfig,
MarkdownConfig,
MessageConfig,
OutputKind,
WordCloudConfig,
YAMLConfig,
apply_runtime_defaults,
get_default_config,
get_... | None | assert | none_literal | tests/test_config.py | test_get_default_config | 30 | null | |
mohamed-chs/convoviz | import io
from zipfile import ZipFile
import pytest
from convoviz.config import ConvovizConfig
from convoviz.exceptions import InvalidZipError
from convoviz.io.loaders import extract_archive
from convoviz.pipeline import run_pipeline
from convoviz.utils import sanitize
def test_sanitize_reserved_names():
assert... | "_CON_" | assert | string_literal | tests/test_security.py | test_sanitize_reserved_names | 49 | null | |
mohamed-chs/convoviz | from pathlib import Path
import pytest
from convoviz.config import (
ALL_OUTPUTS,
AuthorHeaders,
ConversationConfig,
ConvovizConfig,
GraphConfig,
MarkdownConfig,
MessageConfig,
OutputKind,
WordCloudConfig,
YAMLConfig,
apply_runtime_defaults,
get_default_config,
get_... | 600 | assert | numeric_literal | tests/test_config.py | test_wordcloud_config_defaults | 103 | null | |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from unittest.mock import patch
import pytest
from convoviz.analysis.wordcloud import (
_generate_and_save_wordcloud,
generate_wordcloud,
generate_wordclouds,
load_nltk_stopwords,
parse_custom_stopwords,
)
from convoviz.config import Word... | True | assert | bool_literal | tests/test_wordcloud.py | test_generate_and_save_wordcloud_creates_file | 74 | null | |
mohamed-chs/convoviz | from pathlib import Path
from convoviz.config import AuthorHeaders
from convoviz.io.assets import copy_asset
from convoviz.models import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
Node,
)
from convoviz.renderers.markdown import render_node
def create_message_with_attachment(
ms... | "assets/original.png" | assert | string_literal | tests/test_attachment_renaming.py | test_copy_asset_defaults_to_source_name | 135 | null | |
mohamed-chs/convoviz | from pathlib import Path
import pytest
from convoviz.config import (
ALL_OUTPUTS,
AuthorHeaders,
ConversationConfig,
ConvovizConfig,
GraphConfig,
MarkdownConfig,
MessageConfig,
OutputKind,
WordCloudConfig,
YAMLConfig,
apply_runtime_defaults,
get_default_config,
get_... | "## AI" | assert | string_literal | tests/test_config.py | test_author_headers_custom | 80 | null | |
mohamed-chs/convoviz | from datetime import datetime, timedelta
from convoviz.config import AuthorHeaders, ConversationConfig, YAMLConfig
from convoviz.models import Conversation, Node
from convoviz.renderers import render_conversation
from convoviz.renderers.markdown import (
close_code_blocks,
render_message_header,
render_nod... | "" | assert | string_literal | tests/test_renderers.py | test_no_fields | TestRenderYamlHeader | 174 | null |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from convoviz.io.canvas import get_extension, save_canvas_documents
from convoviz.models import Conversation, ConversationCollection
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
def test_can... | msg.text | assert | complex_expr | tests/test_canvas.py | test_canvas_document_extraction | 47 | null | |
mohamed-chs/convoviz | from pathlib import Path
from convoviz.config import AuthorHeaders
from convoviz.io.assets import copy_asset
from convoviz.models import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
Node,
)
from convoviz.renderers.markdown import render_node
def create_message_with_attachment(
ms... | (attachment_id, target_name) | assert | collection | tests/test_attachment_renaming.py | test_render_node_renames_attachment | 71 | null | |
mohamed-chs/convoviz | from datetime import datetime, timedelta
from convoviz.config import AuthorHeaders, ConversationConfig, YAMLConfig
from convoviz.models import Conversation, Node
from convoviz.renderers import render_conversation
from convoviz.renderers.markdown import (
close_code_blocks,
render_message_header,
render_nod... | "# Me" | assert | string_literal | tests/test_renderers.py | test_user_header | TestRenderMessageHeader | 97 | null |
mohamed-chs/convoviz | from pathlib import Path
from convoviz.io.assets import build_asset_index, copy_asset, resolve_asset_path
class TestBuildAssetIndex:
def test_build_asset_index_prefix_maps(self, tmp_path: Path) -> None:
(tmp_path / "file-123-extra.png").touch()
(tmp_path / "file-123.png").touch()
dalle_di... | index.root_prefix_map | assert | complex_expr | tests/test_assets.py | test_build_asset_index_prefix_maps | TestBuildAssetIndex | 172 | null |
mohamed-chs/convoviz | import json
import stat
import time
from pathlib import Path
from zipfile import ZipFile, ZipInfo
import orjson
import pytest
from convoviz.exceptions import InvalidZipError
from convoviz.io.loaders import (
find_latest_valid_zip,
find_script_export,
load_collection,
load_collection_from_json,
loa... | 1 | assert | numeric_literal | tests/test_loaders.py | test_load_from_json_file | TestLoadCollection | 42 | null |
mohamed-chs/convoviz | import copy
from datetime import UTC, datetime, timedelta
from convoviz.models import Conversation
from convoviz.models.collection import ConversationCollection
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
from convoviz.models.node import Node, build_... | 3 | assert | numeric_literal | tests/test_models.py | test_all_message_nodes | 224 | null | |
mohamed-chs/convoviz | import io
from zipfile import ZipFile
import pytest
from convoviz.config import ConvovizConfig
from convoviz.exceptions import InvalidZipError
from convoviz.io.loaders import extract_archive
from convoviz.pipeline import run_pipeline
from convoviz.utils import sanitize
def test_sanitize_path_traversal():
assert... | "etc passwd" | assert | string_literal | tests/test_security.py | test_sanitize_path_traversal | 44 | null | |
mohamed-chs/convoviz | from pathlib import Path
from convoviz.io.assets import build_asset_index, copy_asset, resolve_asset_path
class TestResolveAssetPath:
def test_exact_match(self, tmp_path: Path) -> None:
"""Test finding an asset with an exact name match."""
(tmp_path / "file-123.png").touch()
result = reso... | tmp_path / "file-123.png" | assert | complex_expr | tests/test_assets.py | test_exact_match | TestResolveAssetPath | 15 | null |
mohamed-chs/convoviz | from datetime import datetime
from convoviz.config import YAMLConfig
from convoviz.models import Conversation
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
from convoviz.renderers.markdown import replace_citations
from convoviz.renderers.yaml import re... | "Claim [^1]." | assert | string_literal | tests/test_v3_spec.py | test_replace_citations_obsidian_format | TestCitationParsing | 174 | null |
mohamed-chs/convoviz | from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from convoviz.config import OutputKind, get_default_config
from convoviz.interactive import run_interactive_config
def test_script_export_merge_prompt_declined(
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,
) -> None:
"... | None | assert | none_literal | tests/test_interactive.py | test_script_export_merge_prompt_declined | 354 | null | |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from convoviz.io.canvas import get_extension, save_canvas_documents
from convoviz.models import Conversation, ConversationCollection
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
def test_can... | "breakout_game" | assert | string_literal | tests/test_canvas.py | test_canvas_document_extraction | 42 | null | |
mohamed-chs/convoviz | from pathlib import Path
import pytest
from convoviz.exceptions import ConfigurationError
from convoviz.utils import (
deep_merge_dicts,
expand_path,
normalize_optional_path,
sanitize,
validate_header,
validate_writable_dir,
)
class TestSanitize:
def test_sanitize_replaces_single_quotes(... | "quoted" | assert | string_literal | tests/test_utils.py | test_sanitize_replaces_single_quotes | TestSanitize | 63 | null |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from convoviz.config import (
AuthorHeaders,
ConversationConfig,
FolderOrganization,
YAMLConfig,
)
from convoviz.io.writers import get_date_folder_path, save_collection, save_conversation
from convoviz.models import Conversation, ConversationC... | "test (1).md" | assert | string_literal | tests/test_writers.py | test_save_handles_conflict_different_id | TestSaveConversation | 451 | null |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from convoviz.io.canvas import get_extension, save_canvas_documents
from convoviz.models import Conversation, ConversationCollection
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
def test_con... | 1 | assert | numeric_literal | tests/test_canvas.py | test_conversation_canvas_documents | 90 | null | |
mohamed-chs/convoviz | from datetime import datetime
from convoviz.config import YAMLConfig
from convoviz.models import Conversation
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
from convoviz.renderers.markdown import replace_citations
from convoviz.renderers.yaml import re... | footnotes[0] | assert | complex_expr | tests/test_v3_spec.py | test_replace_citations_obsidian_format | TestCitationParsing | 176 | null |
mohamed-chs/convoviz | from pathlib import Path
from unittest.mock import patch
import pytest
from typer.testing import CliRunner
from convoviz.cli import app
from convoviz.config import OutputKind
runner = CliRunner()
def _isolate_user_config(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
monkeypatch.setattr(
"con... | True | assert | bool_literal | tests/test_cli.py | test_timestamp_flag | 168 | null | |
mohamed-chs/convoviz | from pathlib import Path
from convoviz.io.assets import build_asset_index, copy_asset, resolve_asset_path
class TestCopyAsset:
def test_reuses_existing_when_identical(self, tmp_path: Path) -> None:
src_file = tmp_path / "image.png"
src_file.write_bytes(b"SAME")
dest_dir = tmp_path / "out... | [existing] | assert | collection | tests/test_assets.py | test_reuses_existing_when_identical | TestCopyAsset | 154 | null |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from convoviz.config import (
AuthorHeaders,
ConversationConfig,
FolderOrganization,
YAMLConfig,
)
from convoviz.io.writers import get_date_folder_path, save_collection, save_conversation
from convoviz.models import Conversation, ConversationC... | filepath.read_text() | assert | func_call | tests/test_writers.py | test_save_overwrites_same_identity | TestSaveConversation | 465 | null |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from convoviz.config import (
AuthorHeaders,
ConversationConfig,
FolderOrganization,
YAMLConfig,
)
from convoviz.io.writers import get_date_folder_path, save_collection, save_conversation
from convoviz.models import Conversation, ConversationC... | year_content | assert | variable | tests/test_writers.py | test_date_organization_generates_index_files | TestSaveCollectionWithDateOrganization | 253 | null |
mohamed-chs/convoviz | from pathlib import Path
from convoviz.io.assets import build_asset_index, copy_asset, resolve_asset_path
class TestResolveAssetPath:
def test_user_folder_multiple_users(self, tmp_path: Path) -> None:
"""Test finding asset when multiple user-* folders exist."""
user_dir_1 = tmp_path / "user-111"
... | None | assert | none_literal | tests/test_assets.py | test_user_folder_multiple_users | TestResolveAssetPath | 52 | null |
mohamed-chs/convoviz | from pathlib import Path
from convoviz.config import AuthorHeaders
from convoviz.io.assets import copy_asset
from convoviz.models import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
Node,
)
from convoviz.renderers.markdown import render_node
def create_message_with_attachment(
ms... | result | assert | variable | tests/test_attachment_renaming.py | test_render_node_renames_attachment | 72 | null | |
mohamed-chs/convoviz | from pathlib import Path
import pytest
from convoviz.config import (
ALL_OUTPUTS,
AuthorHeaders,
ConversationConfig,
ConvovizConfig,
GraphConfig,
MarkdownConfig,
MessageConfig,
OutputKind,
WordCloudConfig,
YAMLConfig,
apply_runtime_defaults,
get_default_config,
get_... | fallback | assert | variable | tests/test_config.py | test_apply_runtime_defaults_applies_input_and_font | 49 | null | |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from convoviz.io.canvas import get_extension, save_canvas_documents
from convoviz.models import Conversation, ConversationCollection
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
def test_sav... | "print('hi')" | assert | string_literal | tests/test_canvas.py | test_save_canvas_documents | 144 | null | |
mohamed-chs/convoviz | from pathlib import Path
from convoviz.io.assets import build_asset_index, copy_asset, resolve_asset_path
class TestCopyAsset:
def test_skip_existing_file(self, tmp_path: Path) -> None:
"""Test that existing files are not overwritten and new names are used."""
src_file = tmp_path / "image.png"
... | "assets/image (1).png" | assert | string_literal | tests/test_assets.py | test_skip_existing_file | TestCopyAsset | 138 | null |
mohamed-chs/convoviz | from pathlib import Path
from unittest.mock import patch
import pytest
from typer.testing import CliRunner
from convoviz.cli import app
from convoviz.config import OutputKind
runner = CliRunner()
def _isolate_user_config(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
monkeypatch.setattr(
"con... | {OutputKind.MARKDOWN, OutputKind.GRAPHS} | assert | collection | tests/test_cli.py | test_outputs_flag_multiple | 126 | null | |
mohamed-chs/convoviz | from datetime import UTC, datetime
from convoviz.config import AuthorHeaders, ConversationConfig, MarkdownConfig
from convoviz.models import Conversation
from convoviz.renderers.markdown import render_conversation, render_obsidian_callout
def test_obsidian_flavor_rendering(mock_conversation: Conversation) -> None:
... | markdown | assert | variable | tests/test_markdown_flavors.py | test_obsidian_flavor_rendering | 22 | null | |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from convoviz.io.canvas import get_extension, save_canvas_documents
from convoviz.models import Conversation, ConversationCollection
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
def test_can... | "string_part" | assert | string_literal | tests/test_canvas.py | test_canvas_json_string_in_parts | 169 | null | |
mohamed-chs/convoviz | from convoviz.exceptions import (
ConfigurationError,
ConvovizError,
InvalidZipError,
MessageContentError,
)
class TestConfigurationError:
def test_message(self) -> None:
"""Test error message."""
error = ConfigurationError("Invalid config")
assert str(error) == | "Invalid config" | assert | string_literal | tests/test_exceptions.py | test_message | TestConfigurationError | 46 | null |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from unittest.mock import patch
import pytest
from convoviz.analysis.wordcloud import (
_generate_and_save_wordcloud,
generate_wordcloud,
generate_wordclouds,
load_nltk_stopwords,
parse_custom_stopwords,
)
from convoviz.config import Word... | {"one", "two", "three"} | assert | collection | tests/test_wordcloud.py | test_parse_custom_stopwords | 31 | null | |
mohamed-chs/convoviz | from pathlib import Path
from convoviz.io.assets import build_asset_index, copy_asset, resolve_asset_path
class TestCopyAsset:
def test_skip_existing_file(self, tmp_path: Path) -> None:
"""Test that existing files are not overwritten and new names are used."""
src_file = tmp_path / "image.png"
... | b"OLD" | assert | string_literal | tests/test_assets.py | test_skip_existing_file | TestCopyAsset | 136 | null |
mohamed-chs/convoviz | import copy
from datetime import UTC, datetime, timedelta
from convoviz.models import Conversation
from convoviz.models.collection import ConversationCollection
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
from convoviz.models.node import Node, build_... | 1 | assert | numeric_literal | tests/test_models.py | test_message_count | 30 | null | |
mohamed-chs/convoviz | from convoviz.exceptions import (
ConfigurationError,
ConvovizError,
InvalidZipError,
MessageContentError,
)
class TestConfigurationError:
def test_with_field(self) -> None:
"""Test error with field attribute."""
error = ConfigurationError("Invalid value", field="colormap")
... | "colormap" | assert | string_literal | tests/test_exceptions.py | test_with_field | TestConfigurationError | 51 | null |
mohamed-chs/convoviz | from datetime import datetime
from convoviz.config import YAMLConfig
from convoviz.models import Conversation
from convoviz.models.message import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
)
from convoviz.renderers.markdown import replace_citations
from convoviz.renderers.yaml import re... | [] | assert | collection | tests/test_v3_spec.py | test_replace_citations_out_of_bounds_ignored | TestCitationParsing | 189 | null |
mohamed-chs/convoviz | import json
import stat
import time
from pathlib import Path
from zipfile import ZipFile, ZipInfo
import orjson
import pytest
from convoviz.exceptions import InvalidZipError
from convoviz.io.loaders import (
find_latest_valid_zip,
find_script_export,
load_collection,
load_collection_from_json,
loa... | 2 | assert | numeric_literal | tests/test_loaders.py | test_load_from_directory_multi_file | TestSplitConversationFiles | 295 | null |
mohamed-chs/convoviz | from datetime import datetime, timedelta
from convoviz.config import AuthorHeaders, ConversationConfig, YAMLConfig
from convoviz.models import Conversation, Node
from convoviz.renderers import render_conversation
from convoviz.renderers.markdown import (
close_code_blocks,
render_message_header,
render_nod... | text | assert | variable | tests/test_renderers.py | test_closed_code_block | TestCloseCodeBlocks | 23 | null |
mohamed-chs/convoviz | import json
import stat
import time
from pathlib import Path
from zipfile import ZipFile, ZipInfo
import orjson
import pytest
from convoviz.exceptions import InvalidZipError
from convoviz.io.loaders import (
find_latest_valid_zip,
find_script_export,
load_collection,
load_collection_from_json,
loa... | True | assert | bool_literal | tests/test_loaders.py | test_valid_zip | TestValidateZip | 71 | null |
mohamed-chs/convoviz | from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from convoviz.config import OutputKind, get_default_config
from convoviz.interactive import run_interactive_config
def test_markdown_prompts_skipped_when_not_selected(
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,
) -> None... | 0 | assert | numeric_literal | tests/test_interactive.py | test_markdown_prompts_skipped_when_not_selected | 228 | null | |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from unittest.mock import patch
import pytest
from convoviz.analysis.wordcloud import (
_generate_and_save_wordcloud,
generate_wordcloud,
generate_wordclouds,
load_nltk_stopwords,
parse_custom_stopwords,
)
from convoviz.config import Word... | stopwords | assert | variable | tests/test_wordcloud.py | test_load_nltk_stopwords | 25 | null | |
mohamed-chs/convoviz | from pathlib import Path
from convoviz.config import AuthorHeaders
from convoviz.io.assets import copy_asset
from convoviz.models import (
Message,
MessageAuthor,
MessageContent,
MessageMetadata,
Node,
)
from convoviz.renderers.markdown import render_node
def create_message_with_attachment(
ms... | (attachment_id, None) | assert | collection | tests/test_attachment_renaming.py | test_render_node_no_rename_if_no_metadata | 96 | null | |
mohamed-chs/convoviz | from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from convoviz.config import OutputKind, get_default_config
from convoviz.interactive import run_interactive_config
def test_ctrl_c_on_first_prompt_aborts_interactive(
monkeypatch: pytest.MonkeyPatch,
) -> None:
from convoviz i... | KeyboardInterrupt) | pytest.raises | variable | tests/test_interactive.py | test_ctrl_c_on_first_prompt_aborts_interactive | 36 | null | |
mohamed-chs/convoviz | from pathlib import Path
from unittest.mock import patch
import pytest
from typer.testing import CliRunner
from convoviz.cli import app
from convoviz.config import OutputKind
runner = CliRunner()
def _isolate_user_config(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
monkeypatch.setattr(
"con... | 1 | assert | numeric_literal | tests/test_cli.py | test_config_init_refuses_overwrite | 183 | null | |
mohamed-chs/convoviz | from pathlib import Path
import pytest
from convoviz.exceptions import ConfigurationError
from convoviz.utils import (
deep_merge_dicts,
expand_path,
normalize_optional_path,
sanitize,
validate_header,
validate_writable_dir,
)
class TestSanitize:
def test_sanitize_mixed_complex(self) -> ... | result | assert | variable | tests/test_utils.py | test_sanitize_mixed_complex | TestSanitize | 88 | null |
mohamed-chs/convoviz | from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from convoviz.config import OutputKind, get_default_config
from convoviz.interactive import run_interactive_config
def test_outputs_selection_sets_config(
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,
) -> None:
"""Test... | {OutputKind.MARKDOWN} | assert | collection | tests/test_interactive.py | test_outputs_selection_sets_config | 121 | null | |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from convoviz.config import (
AuthorHeaders,
ConversationConfig,
FolderOrganization,
YAMLConfig,
)
from convoviz.io.writers import get_date_folder_path, save_collection, save_conversation
from convoviz.models import Conversation, ConversationC... | jan_content | assert | variable | tests/test_writers.py | test_date_organization_generates_index_files | TestSaveCollectionWithDateOrganization | 261 | null |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from unittest.mock import patch
import pytest
from convoviz.analysis.wordcloud import (
_generate_and_save_wordcloud,
generate_wordcloud,
generate_wordclouds,
load_nltk_stopwords,
parse_custom_stopwords,
)
from convoviz.config import Word... | 1 | assert | numeric_literal | tests/test_wordcloud.py | test_generate_wordclouds_parallel | 97 | null | |
mohamed-chs/convoviz | import json
import stat
import time
from pathlib import Path
from zipfile import ZipFile, ZipInfo
import orjson
import pytest
from convoviz.exceptions import InvalidZipError
from convoviz.io.loaders import (
find_latest_valid_zip,
find_script_export,
load_collection,
load_collection_from_json,
loa... | 0 | assert | numeric_literal | tests/test_loaders.py | test_load_from_directory | TestLoadCollection | 34 | null |
mohamed-chs/convoviz | from datetime import UTC, datetime
from pathlib import Path
from convoviz.config import (
AuthorHeaders,
ConversationConfig,
FolderOrganization,
YAMLConfig,
)
from convoviz.io.writers import get_date_folder_path, save_collection, save_conversation
from convoviz.models import Conversation, ConversationC... | Path("2024/01-January") | assert | func_call | tests/test_writers.py | test_january | TestGetDateFolderPath | 67 | null |
mohamed-chs/convoviz | import io
from zipfile import ZipFile
import pytest
from convoviz.config import ConvovizConfig
from convoviz.exceptions import InvalidZipError
from convoviz.io.loaders import extract_archive
from convoviz.pipeline import run_pipeline
from convoviz.utils import sanitize
def test_sanitize_path_traversal():
assert ... | "windows system32" | assert | string_literal | tests/test_security.py | test_sanitize_path_traversal | 45 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.