]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-44364:Add non integral tests for `sqrt()` (#26625)
authorAjith Ramachandran <ajithar204@gmail.com>
Thu, 10 Jun 2021 16:27:26 +0000 (21:57 +0530)
committerGitHub <noreply@github.com>
Thu, 10 Jun 2021 16:27:26 +0000 (17:27 +0100)
* Add non integral tests for `sqrt()`

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
Lib/test/test_math.py
Misc/NEWS.d/next/Tests/2021-06-09-15-32-05.bpo-44364.zu9Zee.rst [new file with mode: 0644]

index 3d128749bec40faa8a3b2163df2d1789aa4362f1..9eb455a5cb1973fe8187a6c1a8d3be7a468eb09c 100644 (file)
@@ -1499,6 +1499,10 @@ class MathTests(unittest.TestCase):
     def testSqrt(self):
         self.assertRaises(TypeError, math.sqrt)
         self.ftest('sqrt(0)', math.sqrt(0), 0)
+        self.ftest('sqrt(0)', math.sqrt(0.0), 0.0)
+        self.ftest('sqrt(2.5)', math.sqrt(2.5), 1.5811388300841898)
+        self.ftest('sqrt(0.25)', math.sqrt(0.25), 0.5)
+        self.ftest('sqrt(25.25)', math.sqrt(25.25), 5.024937810560445)
         self.ftest('sqrt(1)', math.sqrt(1), 1)
         self.ftest('sqrt(4)', math.sqrt(4), 2)
         self.assertEqual(math.sqrt(INF), INF)
diff --git a/Misc/NEWS.d/next/Tests/2021-06-09-15-32-05.bpo-44364.zu9Zee.rst b/Misc/NEWS.d/next/Tests/2021-06-09-15-32-05.bpo-44364.zu9Zee.rst
new file mode 100644 (file)
index 0000000..12b80e8
--- /dev/null
@@ -0,0 +1 @@
+Add non integral tests for :func:`math.sqrt` function.