Skip to content

Commit a3569aa

Browse files
committed
Update documentation and CI configuration: standardize test paths and enhance clarity
1 parent 4174f1a commit a3569aa

27 files changed

+254
-78
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ See CONTRIBUTING.md for guidelines.
4545
## Testing
4646

4747
**How has this been tested?**
48-
<!-- Describe the tests_version2 you ran to verify your changes -->
48+
<!-- Describe the tests you ran to verify your changes -->
4949

5050
```python
5151
# Example test code or commands used

.github/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies:
1919
# Tests
2020
tests:
2121
- changed-files:
22-
- any-glob-to-any-file: ['tests_version2/**/*', '**/*test*.py']
22+
- any-glob-to-any-file: ['tests/**/*', '**/*test*.py']
2323

2424
# Examples
2525
examples:

.github/workflows/CI-models.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
pip install -e .
3838
- name: Test with pytest
3939
run: |
40-
pytest tests_version2/
40+
pytest tests/
4141
4242
test_macos:
4343
runs-on: macos-latest
@@ -59,7 +59,7 @@ jobs:
5959
pip install -e .
6060
- name: Test with pytest
6161
run: |
62-
pytest tests_version2/
62+
pytest tests/
6363
6464
test_windows:
6565
runs-on: windows-latest
@@ -81,4 +81,4 @@ jobs:
8181
pip install -e .
8282
- name: Test with pytest
8383
run: |
84-
pytest tests_version2/
84+
pytest tests/

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflow will install Python dependencies, run tests_version2 and lint with a variety of Python versions
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

44
name: Continuous Integration

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@ Branch naming conventions:
114114

115115
Run the test suite:
116116
```bash
117-
pytest tests_version2/
117+
pytest tests/
118118
```
119119

120120
Run specific tests:
121121
```bash
122-
pytest tests_version2/test_specific.py -v
122+
pytest tests/test_specific.py -v
123123
```
124124

125125
### 4. Commit Your Changes
@@ -203,7 +203,7 @@ def simulate_network(network, duration, dt=0.1):
203203

204204
Aim for high test coverage on new code:
205205
```bash
206-
pytest --cov=brainpy tests_version2/
206+
pytest --cov=brainpy tests/
207207
```
208208

209209
## Documentation

brainpy/math/einops_parsing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __init__(self, expression: str, *, allow_underscore: bool = False,
5151
self.identifiers: Set[str] = set()
5252
# that's axes like 2, 3, 4 or 5. Axes with size 1 are exceptional and replaced with empty composition
5353
self.has_non_unitary_anonymous_axes: bool = False
54-
# composition keeps structure of composite axes, see how different corner cases are handled in tests_version2
54+
# composition keeps structure of composite axes, see how different corner cases are handled in tests
5555
self.composition: List[Union[List[str], str]] = []
5656
if '.' in expression:
5757
if '...' not in expression:

brainpy/math/tests/test_einops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def test_rearrange_consistency_numpy():
118118

119119

120120
def test_rearrange_permutations_numpy():
121-
# tests_version2 random permutation of axes against two independent numpy ways
121+
# tests random permutation of axes against two independent numpy ways
122122
for n_axes in range(1, 10):
123123
input = numpy.arange(2 ** n_axes).reshape([2] * n_axes)
124124
permutation = numpy.random.permutation(n_axes)

brainpy/math/tests/test_environment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
class TestEnvironment(unittest.TestCase):
2323
def test_numpy_func_return(self):
24-
# Reset random state to ensure clean state between tests_version2
24+
# Reset random state to ensure clean state between tests
2525
bm.random.seed()
2626

2727
with bm.environment(numpy_func_return='jax_array'):

brainpy/math/tests/test_numpy_einsum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def test_tf_unsupported_3(self):
236236
s = 'ij,ij,jk->ik'
237237
self._check(s, x, y, z)
238238

239-
# these tests_version2 are based on https://github.com/dask/dask/pull/3412/files
239+
# these tests are based on https://github.com/dask/dask/pull/3412/files
240240
@parameterized.named_parameters(
241241
{"testcase_name": "_{}_dtype={}".format(einstr, dtype.__name__), "einstr": einstr,
242242
"dtype": dtype}

brainpy/math/tests/test_numpy_ops.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def op_record(name, nargs, dtypes, shapes, rng_factory, diff_modes,
337337
# TODO(phawkins): np.unwrap does not correctly promote its default period
338338
# argument under NumPy 1.21 for bfloat16 inputs. It works fine if we
339339
# explicitly pass a bfloat16 value that does not need promition. We should
340-
# probably add a custom test harness for unwrap that tests_version2 the period
340+
# probably add a custom test harness for unwrap that tests the period
341341
# argument anyway.
342342
op_record("unwrap", 1, [t for t in float_dtypes if t != dtypes.bfloat16],
343343
nonempty_nonscalar_array_shapes,
@@ -539,7 +539,7 @@ def _promote_like_jnp(fun, inexact=False):
539539
"""Decorator that promotes the arguments of `fun` to `jnp.result_type(*args)`.
540540
541541
jnp and np have different type promotion semantics; this decorator allows
542-
tests_version2 make an np reference implementation act more like an jnp
542+
tests make an np reference implementation act more like an jnp
543543
implementation.
544544
"""
545545
_promote = _promote_dtypes_inexact if inexact else _promote_dtypes
@@ -3056,7 +3056,7 @@ def testIdentity(self, n, dtype):
30563056
for left in [None, 0]
30573057
for right in [None, 1]
30583058
for dtype in default_dtypes
3059-
# following types lack precision for meaningful tests_version2
3059+
# following types lack precision for meaningful tests
30603060
if dtype not in [np.int8, np.int16, np.float16, jnp.bfloat16]
30613061
))
30623062
def testInterp(self, shape, dtype, period, left, right):
@@ -3562,7 +3562,7 @@ def testHistogramBinEdges(self, shape, dtype, bins, range, weights):
35623562
for shape in [(5,), (5, 5)]
35633563
for dtype in default_dtypes
35643564
# We only test explicit integer-valued bin edges because in other cases
3565-
# rounding errors lead to flaky tests_version2.
3565+
# rounding errors lead to flaky tests.
35663566
for bins in [np.arange(-5, 6), np.array([-5, 0, 3])]
35673567
for density in [True, False]
35683568
for weights in [True, False]
@@ -5108,7 +5108,7 @@ def testLongLong(self):
51085108
@jtu.ignore_warning(category=UserWarning,
51095109
message="Explicitly requested dtype.*")
51105110
def testArange(self):
5111-
# test cases inspired by dask tests_version2 at
5111+
# test cases inspired by dask tests at
51125112
# https://github.com/dask/dask/blob/main/dask/array/tests/test_creation.py#L92
51135113
np_arange = jtu.with_jax_dtype_defaults(np.arange)
51145114
self.assertAllClose(bm.arange(77).value,
@@ -5777,7 +5777,7 @@ def testDisableNumpyRankPromotionBroadcasting(self):
57775777
FLAGS.jax_numpy_rank_promotion = prev_flag
57785778

57795779
def testStackArrayArgument(self):
5780-
# tests_version2 https://github.com/google/jax/issues/1271
5780+
# tests https://github.com/google/jax/issues/1271
57815781
@jax.jit
57825782
def foo(x):
57835783
return bm.stack(x)
@@ -6050,7 +6050,7 @@ def testFromString(self):
60506050
self.assertArraysEqual(expected, actual)
60516051

60526052

6053-
# Most grad tests_version2 are at the lax level (see lax_test.py), but we add some here
6053+
# Most grad tests are at the lax level (see lax_test.py), but we add some here
60546054
# as needed for e.g. particular compound ops of interest.
60556055

60566056
GradTestSpec = collections.namedtuple(
@@ -6126,7 +6126,7 @@ def testOpGradSpecialValue(self, op, special_value, order):
61266126
atol={np.float32: 3e-3})
61276127

61286128
def testSincGradArrayInput(self):
6129-
# tests_version2 for a bug almost introduced in #5077
6129+
# tests for a bug almost introduced in #5077
61306130
jax.grad(lambda x: bm.sinc(x).sum())(jnp.arange(10.)) # doesn't crash
61316131

61326132
def testTakeAlongAxisIssue1521(self):

0 commit comments

Comments
 (0)