GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — DOC: Document assertion comparison behavior between scalar and empty … · timhoffm/numpy@6a26499

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • numpy/testing/_private
    • utils.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎numpy/testing/_private/utils.py‎

Copy file name to clipboardExpand all lines: numpy/testing/_private/utils.py
+12-10Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,10 @@ def assert_equal(actual, desired, err_msg='', verbose=True, *, strict=False):
293293
294294
Notes
295295
-----
296-
By default, when one of `actual` and `desired` is a scalar and the other is
297-
an array, the function checks that each element of the array is equal to
298-
the scalar. This behaviour can be disabled by setting ``strict==True``.
296+
When one of `actual` and `desired` is a scalar and the other is array_like, the
297+
function checks that each element of the array_like is equal to the scalar.
298+
Note that empty arrays are therefore considered equal to scalars.
299+
This behaviour can be disabled by setting ``strict==True``.
299300
300301
Examples
301302
--------
@@ -980,9 +981,10 @@ def assert_array_equal(actual, desired, err_msg='', verbose=True, *,
980981
981982
Notes
982983
-----
983-
When one of `actual` and `desired` is a scalar and the other is array_like,
984-
the function checks that each element of the array_like object is equal to
985-
the scalar. This behaviour can be disabled with the `strict` parameter.
984+
When one of `actual` and `desired` is a scalar and the other is array_like, the
985+
function checks that each element of the array_like is equal to the scalar.
986+
Note that empty arrays are therefore considered equal to scalars.
987+
This behaviour can be disabled by setting ``strict==True``.
986988
987989
Examples
988990
--------
@@ -1651,10 +1653,10 @@ def assert_allclose(actual, desired, rtol=1e-7, atol=0, equal_nan=True,
16511653
16521654
Notes
16531655
-----
1654-
When one of `actual` and `desired` is a scalar and the other is
1655-
array_like, the function performs the comparison as if the scalar were
1656-
broadcasted to the shape of the array.
1657-
This behaviour can be disabled with the `strict` parameter.
1656+
When one of `actual` and `desired` is a scalar and the other is array_like, the
1657+
function performs the comparison as if the scalar were broadcasted to the shape
1658+
of the array. Note that empty arrays are therefore considered equal to scalars.
1659+
This behaviour can be disabled by setting ``strict==True``.
16581660
16591661
Examples
16601662
--------

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.