You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+19-1Lines changed: 19 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,8 @@ Example: `FPS` (Farthest Point Sampling) exists as both `feature_selection.FPS`
24
24
25
25
## Development Workflows
26
26
27
+
Use 88 character line length limit for code and docstrings.
28
+
27
29
### Testing
28
30
```bash
29
31
# Run all tests with coverage
@@ -39,11 +41,27 @@ tox -e tests-dev
39
41
Tests use pytest-style assertions and fixtures. Common patterns:
40
42
- Use `@pytest.fixture` for test data setup
41
43
- Use `assert` statements instead of `self.assertEqual()`
42
-
- Use `pytest.raises()` for exception testing
44
+
- Use `pytest.raises()` for exception testing always `match=` parameter. If match is too long that the `with` statement exceeds line length, define `match` variable before.
43
45
- Use `pytest.warns()` for warning testing
44
46
- Use `pytest.mark.parametrize` for parameterized tests
45
47
- Tests often load datasets via `skmatter.datasets.load_*()`
46
48
49
+
**Exception Testing Style:**
50
+
- Keep `with pytest.raises(...)` statement on one line (88 char limit)
51
+
- For long match strings, define a `match` variable before the with statement:
52
+
```python
53
+
match ="Long error message that would exceed line length limit"
54
+
with pytest.raises(ValueError, match=match):
55
+
some_function()
56
+
```
57
+
- Use `re.escape()` when matching messages with special regex characters:
58
+
```python
59
+
import re
60
+
match =f"Found array with shape={X.shape} ..."
61
+
with pytest.raises(ValueError, match=re.escape(match)):
0 commit comments