-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathtest_context_factory.py
More file actions
43 lines (36 loc) · 1.38 KB
/
Copy pathtest_context_factory.py
File metadata and controls
43 lines (36 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import pytest
from notebook_intelligence.context_factory import RuleContextFactory
from notebook_intelligence.ruleset import RuleContext
class TestRuleContextFactory:
def test_create(self):
"""Test creating RuleContext from WebSocket data."""
filename = "test.ipynb"
language = "python"
chat_mode_id = "ask"
root_dir = "/workspace"
context = RuleContextFactory.create(
filename=filename,
language=language,
chat_mode_id=chat_mode_id,
root_dir=root_dir
)
assert context.filename == filename
assert context.kernel == language
assert context.mode == chat_mode_id
assert context.directory == "/workspace"
def test_create_with_subdirectory(self):
"""Test creating RuleContext with file in subdirectory."""
filename = "notebooks/analysis.ipynb"
language = "python"
chat_mode_id = "agent"
root_dir = "/workspace"
context = RuleContextFactory.create(
filename=filename,
language=language,
chat_mode_id=chat_mode_id,
root_dir=root_dir
)
assert context.filename == filename
assert context.kernel == language
assert context.mode == chat_mode_id
assert context.directory == "/workspace/notebooks"