From aa475b944e65da956995355da11820edf6a7f39d Mon Sep 17 00:00:00 2001 From: Andrew Rosen Date: Wed, 20 Sep 2023 13:50:21 -0700 Subject: [PATCH] isort + black --- src/template/sample.py | 10 ++++++---- tests/sample/test_sample.py | 11 ++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/template/sample.py b/src/template/sample.py index 3babe14..e55a1a5 100644 --- a/src/template/sample.py +++ b/src/template/sample.py @@ -1,4 +1,5 @@ from __future__ import annotations + import numpy as np @@ -12,15 +13,16 @@ def add(a: float, b: float) -> float: First number to add. b Second number to add. - + Returns ------- float The sum of a and b. - + """ return a + b + def make_array(val: float | float, length: int = 3) -> np.ndarray: """ A function to transform a number into a numpy array. @@ -31,10 +33,10 @@ def make_array(val: float | float, length: int = 3) -> np.ndarray: Number to turn into an array. length The length of the array. - + Returns ------- np.ndarray An array composed of `val`. """ - return np.array([val]*length) + return np.array([val] * length) diff --git a/tests/sample/test_sample.py b/tests/sample/test_sample.py index bf4fd80..583ac73 100644 --- a/tests/sample/test_sample.py +++ b/tests/sample/test_sample.py @@ -1,14 +1,15 @@ -import pytest import numpy as np +import pytest from numpy.testing import assert_allclose from template.sample import add, make_array def test_add(): - assert add(1, 2) == 3 - assert add(1.5, 2.0) == pytest.approx(3.5) + assert add(1, 2) == 3 + assert add(1.5, 2.0) == pytest.approx(3.5) + def test_make_array(): - assert_allclose(make_array(3), np.array([3, 3, 3])) - assert_allclose(make_array(3, 4), np.array([3, 3, 3, 3])) + assert_allclose(make_array(3), np.array([3, 3, 3])) + assert_allclose(make_array(3, 4), np.array([3, 3, 3, 3]))