()
| 1601 | |
| 1602 | |
| 1603 | def test_empty_str_methods() -> None: |
| 1604 | empty = xr.DataArray(np.empty(shape=(0,), dtype="U")) |
| 1605 | empty_str = empty |
| 1606 | empty_int = xr.DataArray(np.empty(shape=(0,), dtype=int)) |
| 1607 | empty_bool = xr.DataArray(np.empty(shape=(0,), dtype=bool)) |
| 1608 | empty_bytes = xr.DataArray(np.empty(shape=(0,), dtype="S")) |
| 1609 | |
| 1610 | # TODO: Determine why U and S dtype sizes don't match and figure |
| 1611 | # out a reliable way to predict what they should be |
| 1612 | |
| 1613 | assert empty_bool.dtype == empty.str.contains("a").dtype |
| 1614 | assert empty_bool.dtype == empty.str.endswith("a").dtype |
| 1615 | assert empty_bool.dtype == empty.str.match("^a").dtype |
| 1616 | assert empty_bool.dtype == empty.str.startswith("a").dtype |
| 1617 | assert empty_bool.dtype == empty.str.isalnum().dtype |
| 1618 | assert empty_bool.dtype == empty.str.isalpha().dtype |
| 1619 | assert empty_bool.dtype == empty.str.isdecimal().dtype |
| 1620 | assert empty_bool.dtype == empty.str.isdigit().dtype |
| 1621 | assert empty_bool.dtype == empty.str.islower().dtype |
| 1622 | assert empty_bool.dtype == empty.str.isnumeric().dtype |
| 1623 | assert empty_bool.dtype == empty.str.isspace().dtype |
| 1624 | assert empty_bool.dtype == empty.str.istitle().dtype |
| 1625 | assert empty_bool.dtype == empty.str.isupper().dtype |
| 1626 | assert empty_bytes.dtype.kind == empty.str.encode("ascii").dtype.kind |
| 1627 | assert empty_int.dtype.kind == empty.str.count("a").dtype.kind |
| 1628 | assert empty_int.dtype.kind == empty.str.find("a").dtype.kind |
| 1629 | assert empty_int.dtype.kind == empty.str.len().dtype.kind |
| 1630 | assert empty_int.dtype.kind == empty.str.rfind("a").dtype.kind |
| 1631 | assert empty_str.dtype.kind == empty.str.capitalize().dtype.kind |
| 1632 | assert empty_str.dtype.kind == empty.str.center(42).dtype.kind |
| 1633 | assert empty_str.dtype.kind == empty.str.get(0).dtype.kind |
| 1634 | assert empty_str.dtype.kind == empty.str.lower().dtype.kind |
| 1635 | assert empty_str.dtype.kind == empty.str.lstrip().dtype.kind |
| 1636 | assert empty_str.dtype.kind == empty.str.pad(42).dtype.kind |
| 1637 | assert empty_str.dtype.kind == empty.str.repeat(3).dtype.kind |
| 1638 | assert empty_str.dtype.kind == empty.str.rstrip().dtype.kind |
| 1639 | assert empty_str.dtype.kind == empty.str.slice(step=1).dtype.kind |
| 1640 | assert empty_str.dtype.kind == empty.str.slice(stop=1).dtype.kind |
| 1641 | assert empty_str.dtype.kind == empty.str.strip().dtype.kind |
| 1642 | assert empty_str.dtype.kind == empty.str.swapcase().dtype.kind |
| 1643 | assert empty_str.dtype.kind == empty.str.title().dtype.kind |
| 1644 | assert empty_str.dtype.kind == empty.str.upper().dtype.kind |
| 1645 | assert empty_str.dtype.kind == empty.str.wrap(42).dtype.kind |
| 1646 | assert empty_str.dtype.kind == empty_bytes.str.decode("ascii").dtype.kind |
| 1647 | |
| 1648 | assert_equal(empty_bool, empty.str.contains("a")) |
| 1649 | assert_equal(empty_bool, empty.str.endswith("a")) |
| 1650 | assert_equal(empty_bool, empty.str.match("^a")) |
| 1651 | assert_equal(empty_bool, empty.str.startswith("a")) |
| 1652 | assert_equal(empty_bool, empty.str.isalnum()) |
| 1653 | assert_equal(empty_bool, empty.str.isalpha()) |
| 1654 | assert_equal(empty_bool, empty.str.isdecimal()) |
| 1655 | assert_equal(empty_bool, empty.str.isdigit()) |
| 1656 | assert_equal(empty_bool, empty.str.islower()) |
| 1657 | assert_equal(empty_bool, empty.str.isnumeric()) |
| 1658 | assert_equal(empty_bool, empty.str.isspace()) |
| 1659 | assert_equal(empty_bool, empty.str.istitle()) |
| 1660 | assert_equal(empty_bool, empty.str.isupper()) |
nothing calls this directly
no test coverage detected
searching dependent graphs…