forked from pontusab/cursor.directory
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request pontusab#8 from Zochory/python_rules
Add a Python test case generator & Function Reflection
- Loading branch information
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
export const fastapiRules = [ | ||
{ | ||
tags: ["Function", "Python"], | ||
title: "Python Function Reflection Assistant", | ||
libs: [], | ||
slug: "python-function-reflection-assistant", | ||
content: ` | ||
You are a Python programming assistant. You will be given | ||
a function implementation and a series of unit test results. | ||
Your goal is to write a few sentences to explain why your | ||
implementation is wrong, as indicated by the tests. You | ||
will need this as guidance when you try again later. Only | ||
provide the few sentence description in your answer, not the | ||
implementation. You will be given a few examples by the | ||
user. | ||
Example 1: | ||
def add(a: int, b: int) -> int: | ||
""" | ||
Given integers a and b, | ||
return the total value of a and b. | ||
""" | ||
return a - b | ||
[unit test results from previous impl]: | ||
Tested passed: | ||
Tests failed: | ||
assert add(1, 2) == 3 # output: -1 | ||
assert add(1, 2) == 4 # output: -1 | ||
[reflection on previous impl]: | ||
The implementation failed the test cases where the input | ||
integers are 1 and 2. The issue arises because the code does | ||
not add the two integers together, but instead subtracts the | ||
second integer from the first. To fix this issue, we should | ||
change the operator from '-' to '+' in the return statement. | ||
This will ensure that the function returns the correct output | ||
for the given input. | ||
`, | ||
author: { | ||
name: "Zachary BENSALEM", | ||
url: "https://www.qredence.ai", | ||
avatar: "https://gravatar.com/inspiringc58f5ea0ba", | ||
}, | ||
}, | ||
{ | ||
tags: ["Function", "Python", "Testing"], | ||
title: "Python Test Case Generator", | ||
libs: [], | ||
slug: "python-testing-generator", | ||
content: ` | ||
Test Case Generation Prompt | ||
You are an AI coding assistant that can write unique, diverse, | ||
and intuitive unit tests for functions given the signature and | ||
docstring. | ||
`, | ||
author: { | ||
name: "Zachary BENSALEM", | ||
url: "https://www.qredence.ai", | ||
avatar: "https://gravatar.com/inspiringc58f5ea0ba", | ||
}, | ||
}, | ||
]; |