From aba8bddb27d99ab764f1c91d7c6005a9c1a10b7c Mon Sep 17 00:00:00 2001 From: Matthew Silverman Date: Fri, 6 Dec 2024 18:49:07 +0000 Subject: [PATCH] codefactor, avoid code injection --- .github/workflows/tests_numpy.yml | 4 +++- .github/workflows/tests_tensorflow.yml | 4 +++- tests/test_physics/test_wires.py | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests_numpy.yml b/.github/workflows/tests_numpy.yml index ee794f78b..7a63cb844 100644 --- a/.github/workflows/tests_numpy.yml +++ b/.github/workflows/tests_numpy.yml @@ -59,6 +59,8 @@ jobs: - name: Copy durations to s3 if: github.event_name == 'push' + env: + REF_NAME: ${{ github.ref_name }} run: | grep ' call ' durations.txt | awk '{print $3,$1}' > ${{ steps.record_file.outputs.filename }} - aws s3 cp ./${{ steps.record_file.outputs.filename }} s3://${{ secrets.AWS_TIMINGS_BUCKET }}/numpy_tests/${{ github.ref_name }}/ + aws s3 cp ./${{ steps.record_file.outputs.filename }} s3://${{ secrets.AWS_TIMINGS_BUCKET }}/numpy_tests/${{ env.REF_NAME }}/ diff --git a/.github/workflows/tests_tensorflow.yml b/.github/workflows/tests_tensorflow.yml index 959ec7c3f..9c55ed9e9 100644 --- a/.github/workflows/tests_tensorflow.yml +++ b/.github/workflows/tests_tensorflow.yml @@ -66,6 +66,8 @@ jobs: - name: Copy durations to s3 if: github.event_name == 'push' + env: + REF_NAME: ${{ github.ref_name }} run: | grep ' call ' durations.txt | awk '{print $3,$1}' > ${{ steps.record_file.outputs.filename }} - aws s3 cp ./${{ steps.record_file.outputs.filename }} s3://${{ secrets.AWS_TIMINGS_BUCKET }}/tf_tests/${{ github.ref_name }}/ + aws s3 cp ./${{ steps.record_file.outputs.filename }} s3://${{ secrets.AWS_TIMINGS_BUCKET }}/tf_tests/${{ env.REF_NAME }}/ diff --git a/tests/test_physics/test_wires.py b/tests/test_physics/test_wires.py index e7dcab326..8b70745e6 100644 --- a/tests/test_physics/test_wires.py +++ b/tests/test_physics/test_wires.py @@ -229,6 +229,10 @@ def test_matmul_error(self): with pytest.raises(ValueError): u @ v # pylint: disable=pointless-statement + +class TestWiresDisplay: + """Test the wires _ipython_display_ functionality.""" + @patch("mrmustard.physics.wires.display") def test_ipython_repr(self, mock_display): """Test the IPython repr function."""