mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-22 23:33:02 +08:00
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:
@ -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)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user