Ruff pandas vet (#10281)

* Python linting: Add ruff rules for Pandas-vet and Pytest-style

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
Christian Clauss
2023-10-11 20:30:02 +02:00
committed by GitHub
parent d5323dbaee
commit 3f094fe49d
28 changed files with 260 additions and 241 deletions

View File

@ -1,6 +1,7 @@
import unittest
import numpy as np
import pytest
def schur_complement(
@ -70,14 +71,14 @@ class TestSchurComplement(unittest.TestCase):
det_a = np.linalg.det(a)
det_s = np.linalg.det(s)
self.assertAlmostEqual(det_x, det_a * det_s)
assert np.is_close(det_x, det_a * det_s)
def test_improper_a_b_dimensions(self) -> None:
a = np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]])
b = np.array([[0, 3], [3, 0], [2, 3]])
c = np.array([[2, 1], [6, 3]])
with self.assertRaises(ValueError):
with pytest.raises(ValueError):
schur_complement(a, b, c)
def test_improper_b_c_dimensions(self) -> None:
@ -85,7 +86,7 @@ class TestSchurComplement(unittest.TestCase):
b = np.array([[0, 3], [3, 0], [2, 3]])
c = np.array([[2, 1, 3], [6, 3, 5]])
with self.assertRaises(ValueError):
with pytest.raises(ValueError):
schur_complement(a, b, c)