Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 40 additions & 40 deletions pandas/tests/dtypes/test_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,46 +62,46 @@ def coerce(request):
# collect all objects to be tested for list-like-ness; use tuples of objects,
# whether they are list-like or not (special casing for sets), and their ID
ll_params = [
([1], True, "list"), # noqa: E241
([], True, "list-empty"), # noqa: E241
((1,), True, "tuple"), # noqa: E241
(tuple(), True, "tuple-empty"), # noqa: E241
({"a": 1}, True, "dict"), # noqa: E241
(dict(), True, "dict-empty"), # noqa: E241
({"a", 1}, "set", "set"), # noqa: E241
(set(), "set", "set-empty"), # noqa: E241
(frozenset({"a", 1}), "set", "frozenset"), # noqa: E241
(frozenset(), "set", "frozenset-empty"), # noqa: E241
(iter([1, 2]), True, "iterator"), # noqa: E241
(iter([]), True, "iterator-empty"), # noqa: E241
((x for x in [1, 2]), True, "generator"), # noqa: E241
((_ for _ in []), True, "generator-empty"), # noqa: E241
(Series([1]), True, "Series"), # noqa: E241
(Series([]), True, "Series-empty"), # noqa: E241
(Series(["a"]).str, True, "StringMethods"), # noqa: E241
(Series([], dtype="O").str, True, "StringMethods-empty"), # noqa: E241
(Index([1]), True, "Index"), # noqa: E241
(Index([]), True, "Index-empty"), # noqa: E241
(DataFrame([[1]]), True, "DataFrame"), # noqa: E241
(DataFrame(), True, "DataFrame-empty"), # noqa: E241
(np.ndarray((2,) * 1), True, "ndarray-1d"), # noqa: E241
(np.array([]), True, "ndarray-1d-empty"), # noqa: E241
(np.ndarray((2,) * 2), True, "ndarray-2d"), # noqa: E241
(np.array([[]]), True, "ndarray-2d-empty"), # noqa: E241
(np.ndarray((2,) * 3), True, "ndarray-3d"), # noqa: E241
(np.array([[[]]]), True, "ndarray-3d-empty"), # noqa: E241
(np.ndarray((2,) * 4), True, "ndarray-4d"), # noqa: E241
(np.array([[[[]]]]), True, "ndarray-4d-empty"), # noqa: E241
(np.array(2), False, "ndarray-0d"), # noqa: E241
(1, False, "int"), # noqa: E241
(b"123", False, "bytes"), # noqa: E241
(b"", False, "bytes-empty"), # noqa: E241
("123", False, "string"), # noqa: E241
("", False, "string-empty"), # noqa: E241
(str, False, "string-type"), # noqa: E241
(object(), False, "object"), # noqa: E241
(np.nan, False, "NaN"), # noqa: E241
(None, False, "None"), # noqa: E241
([1], True, "list"),
([], True, "list-empty"),
((1,), True, "tuple"),
(tuple(), True, "tuple-empty"),
({"a": 1}, True, "dict"),
(dict(), True, "dict-empty"),
({"a", 1}, "set", "set"),
(set(), "set", "set-empty"),
(frozenset({"a", 1}), "set", "frozenset"),
(frozenset(), "set", "frozenset-empty"),
(iter([1, 2]), True, "iterator"),
(iter([]), True, "iterator-empty"),
((x for x in [1, 2]), True, "generator"),
((_ for _ in []), True, "generator-empty"),
(Series([1]), True, "Series"),
(Series([]), True, "Series-empty"),
(Series(["a"]).str, True, "StringMethods"),
(Series([], dtype="O").str, True, "StringMethods-empty"),
(Index([1]), True, "Index"),
(Index([]), True, "Index-empty"),
(DataFrame([[1]]), True, "DataFrame"),
(DataFrame(), True, "DataFrame-empty"),
(np.ndarray((2,) * 1), True, "ndarray-1d"),
(np.array([]), True, "ndarray-1d-empty"),
(np.ndarray((2,) * 2), True, "ndarray-2d"),
(np.array([[]]), True, "ndarray-2d-empty"),
(np.ndarray((2,) * 3), True, "ndarray-3d"),
(np.array([[[]]]), True, "ndarray-3d-empty"),
(np.ndarray((2,) * 4), True, "ndarray-4d"),
(np.array([[[[]]]]), True, "ndarray-4d-empty"),
(np.array(2), False, "ndarray-0d"),
(1, False, "int"),
(b"123", False, "bytes"),
(b"", False, "bytes-empty"),
("123", False, "string"),
("", False, "string-empty"),
(str, False, "string-type"),
(object(), False, "object"),
(np.nan, False, "NaN"),
(None, False, "None"),
]
objs, expected, ids = zip(*ll_params)

Expand Down
74 changes: 37 additions & 37 deletions pandas/tests/test_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,46 +21,46 @@ def assert_series_or_index_equal(left, right):


_any_string_method = [
("cat", (), {"sep": ","}), # noqa: E241
("cat", (Series(list("zyx")),), {"sep": ",", "join": "left"}), # noqa: E241
("center", (10,), {}), # noqa: E241
("contains", ("a",), {}), # noqa: E241
("count", ("a",), {}), # noqa: E241
("decode", ("UTF-8",), {}), # noqa: E241
("encode", ("UTF-8",), {}), # noqa: E241
("endswith", ("a",), {}), # noqa: E241
("extract", ("([a-z]*)",), {"expand": False}), # noqa: E241
("extract", ("([a-z]*)",), {"expand": True}), # noqa: E241
("extractall", ("([a-z]*)",), {}), # noqa: E241
("find", ("a",), {}), # noqa: E241
("findall", ("a",), {}), # noqa: E241
("get", (0,), {}), # noqa: E241
("cat", (), {"sep": ","}),
("cat", (Series(list("zyx")),), {"sep": ",", "join": "left"}),
("center", (10,), {}),
("contains", ("a",), {}),
("count", ("a",), {}),
("decode", ("UTF-8",), {}),
("encode", ("UTF-8",), {}),
("endswith", ("a",), {}),
("extract", ("([a-z]*)",), {"expand": False}),
("extract", ("([a-z]*)",), {"expand": True}),
("extractall", ("([a-z]*)",), {}),
("find", ("a",), {}),
("findall", ("a",), {}),
("get", (0,), {}),
# because "index" (and "rindex") fail intentionally
# if the string is not found, search only for empty string
("index", ("",), {}), # noqa: E241
("join", (",",), {}), # noqa: E241
("ljust", (10,), {}), # noqa: E241
("match", ("a",), {}), # noqa: E241
("normalize", ("NFC",), {}), # noqa: E241
("pad", (10,), {}), # noqa: E241
("partition", (" ",), {"expand": False}), # noqa: E241
("partition", (" ",), {"expand": True}), # noqa: E241
("repeat", (3,), {}), # noqa: E241
("replace", ("a", "z"), {}), # noqa: E241
("rfind", ("a",), {}), # noqa: E241
("rindex", ("",), {}), # noqa: E241
("rjust", (10,), {}), # noqa: E241
("rpartition", (" ",), {"expand": False}), # noqa: E241
("rpartition", (" ",), {"expand": True}), # noqa: E241
("slice", (0, 1), {}), # noqa: E241
("slice_replace", (0, 1, "z"), {}), # noqa: E241
("split", (" ",), {"expand": False}), # noqa: E241
("split", (" ",), {"expand": True}), # noqa: E241
("startswith", ("a",), {}), # noqa: E241
("index", ("",), {}),
("join", (",",), {}),
("ljust", (10,), {}),
("match", ("a",), {}),
("normalize", ("NFC",), {}),
("pad", (10,), {}),
("partition", (" ",), {"expand": False}),
("partition", (" ",), {"expand": True}),
("repeat", (3,), {}),
("replace", ("a", "z"), {}),
("rfind", ("a",), {}),
("rindex", ("",), {}),
("rjust", (10,), {}),
("rpartition", (" ",), {"expand": False}),
("rpartition", (" ",), {"expand": True}),
("slice", (0, 1), {}),
("slice_replace", (0, 1, "z"), {}),
("split", (" ",), {"expand": False}),
("split", (" ",), {"expand": True}),
("startswith", ("a",), {}),
# translating unicode points of "a" to "d"
("translate", ({97: 100},), {}), # noqa: E241
("wrap", (2,), {}), # noqa: E241
("zfill", (10,), {}), # noqa: E241
("translate", ({97: 100},), {}),
("wrap", (2,), {}),
("zfill", (10,), {}),
] + list(
zip(
[
Expand Down