MCPcopy Create free account
hub / github.com/numpy/numpy / test_shape_scalar

Method test_shape_scalar

numpy/ma/tests/test_extras.py:1710–1750  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1708 assert_equal(b.mask.shape, b.data.shape)
1709
1710 def test_shape_scalar(self):
1711 # the atleast and diagflat function should work with scalars
1712 # GitHub issue #3367
1713 # Additionally, the atleast functions should accept multiple scalars
1714 # correctly
1715 b = atleast_1d(1.0)
1716 assert_equal(b.shape, (1,))
1717 assert_equal(b.mask.shape, b.shape)
1718 assert_equal(b.data.shape, b.shape)
1719
1720 b = atleast_1d(1.0, 2.0)
1721 for a in b:
1722 assert_equal(a.shape, (1,))
1723 assert_equal(a.mask.shape, a.shape)
1724 assert_equal(a.data.shape, a.shape)
1725
1726 b = atleast_2d(1.0)
1727 assert_equal(b.shape, (1, 1))
1728 assert_equal(b.mask.shape, b.shape)
1729 assert_equal(b.data.shape, b.shape)
1730
1731 b = atleast_2d(1.0, 2.0)
1732 for a in b:
1733 assert_equal(a.shape, (1, 1))
1734 assert_equal(a.mask.shape, a.shape)
1735 assert_equal(a.data.shape, a.shape)
1736
1737 b = atleast_3d(1.0)
1738 assert_equal(b.shape, (1, 1, 1))
1739 assert_equal(b.mask.shape, b.shape)
1740 assert_equal(b.data.shape, b.shape)
1741
1742 b = atleast_3d(1.0, 2.0)
1743 for a in b:
1744 assert_equal(a.shape, (1, 1, 1))
1745 assert_equal(a.mask.shape, a.shape)
1746 assert_equal(a.data.shape, a.shape)
1747
1748 b = diagflat(1.0)
1749 assert_equal(b.shape, (1, 1))
1750 assert_equal(b.mask.shape, b.data.shape)
1751
1752
1753class TestNDEnumerate:

Callers

nothing calls this directly

Calls 5

assert_equalFunction · 0.90
atleast_1dFunction · 0.85
atleast_2dFunction · 0.85
atleast_3dFunction · 0.85
diagflatFunction · 0.85

Tested by

no test coverage detected