[Python-checkins] bpo-44364:Add non integral tests for `sqrt()` (#26625)

mdickinson webhook-mailer at python.org
Thu Jun 10 12:27:34 EDT 2021


https://github.com/python/cpython/commit/90cd4330329a99e52f7141db5e0a469d30088e66
commit: 90cd4330329a99e52f7141db5e0a469d30088e66
branch: main
author: Ajith Ramachandran <ajithar204 at gmail.com>
committer: mdickinson <dickinsm at gmail.com>
date: 2021-06-10T17:27:26+01:00
summary:

bpo-44364:Add non integral tests for `sqrt()` (#26625)

* Add non integral tests for `sqrt()`

Co-authored-by: Mark Dickinson <dickinsm at gmail.com>

files:
A Misc/NEWS.d/next/Tests/2021-06-09-15-32-05.bpo-44364.zu9Zee.rst
M Lib/test/test_math.py

diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py
index 3d128749bec40..9eb455a5cb197 100644
--- a/Lib/test/test_math.py
+++ b/Lib/test/test_math.py
@@ -1499,6 +1499,10 @@ def testSinh(self):
     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
index 0000000000000..12b80e8e6533b
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2021-06-09-15-32-05.bpo-44364.zu9Zee.rst
@@ -0,0 +1 @@
+Add non integral tests for :func:`math.sqrt` function.



More information about the Python-checkins mailing list