Skip to content

Commit d863a0d

Browse files
fix test for windows
1 parent c7941e9 commit d863a0d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

codeflash/models/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class CodeString(BaseModel):
163163

164164

165165
def get_code_block_splitter(file_path: Path) -> str:
166-
return f"# file: {file_path}"
166+
return f"# file: {file_path.as_posix()}"
167167

168168

169169
markdown_pattern = re.compile(r"```python:([^\n]+)\n(.*?)\n```", re.DOTALL)

tests/test_get_helper_code.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from codeflash.discovery.functions_to_optimize import FunctionToOptimize
88
from codeflash.either import is_successful
9-
from codeflash.models.models import FunctionParent
9+
from codeflash.models.models import FunctionParent, get_code_block_splitter
1010
from codeflash.optimization.function_optimizer import FunctionOptimizer
1111
from codeflash.optimization.optimizer import Optimizer
1212
from codeflash.verification.verification_utils import TestConfig
@@ -413,17 +413,17 @@ def test_bubble_sort_deps() -> None:
413413
code_context = ctx_result.unwrap()
414414
assert (
415415
code_context.testgen_context.flat
416-
== f"""# file: code_to_optimize/bubble_sort_dep1_helper.py
416+
== f"""{get_code_block_splitter(Path("code_to_optimize/bubble_sort_dep1_helper.py"))}
417417
def dep1_comparer(arr, j: int) -> bool:
418418
return arr[j] > arr[j + 1]
419419
420-
# file: code_to_optimize/bubble_sort_dep2_swap.py
420+
{get_code_block_splitter(Path("code_to_optimize/bubble_sort_dep2_swap.py"))}
421421
def dep2_swap(arr, j):
422422
temp = arr[j]
423423
arr[j] = arr[j + 1]
424424
arr[j + 1] = temp
425425
426-
# file: code_to_optimize/bubble_sort_deps.py
426+
{get_code_block_splitter(Path("code_to_optimize/bubble_sort_deps.py"))}
427427
from code_to_optimize.bubble_sort_dep1_helper import dep1_comparer
428428
from code_to_optimize.bubble_sort_dep2_swap import dep2_swap
429429

0 commit comments

Comments
 (0)