diff --git a/pandas-stubs/_typing.pyi b/pandas-stubs/_typing.pyi index 5e6e64cba..e46f4e739 100644 --- a/pandas-stubs/_typing.pyi +++ b/pandas-stubs/_typing.pyi @@ -318,7 +318,7 @@ MergeHow: TypeAlias = Union[JoinHow, Literal["cross"]] JsonFrameOrient: TypeAlias = Literal[ "split", "records", "index", "columns", "values", "table" ] -JsonSeriesOrient: TypeAlias = Literal["split", "records", "index"] +JsonSeriesOrient: TypeAlias = Literal["split", "records", "index", "table"] TimestampConvention: TypeAlias = Literal["start", "end", "s", "e"] diff --git a/tests/test_io.py b/tests/test_io.py index aeb3c392a..2817b170d 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -393,6 +393,37 @@ def test_json_series(): check(assert_type(s.to_json(path), None), type(None)) check(assert_type(read_json(path, typ="series"), Series), Series) check(assert_type(DF.to_json(), str), str) + check( + assert_type( + read_json(s.to_json(orient=None), typ="series", orient=None), Series + ), + Series, + ) + check( + assert_type( + read_json(s.to_json(orient="split"), typ="series", orient="split"), Series + ), + Series, + ) + check( + assert_type( + read_json(s.to_json(orient="records"), typ="series", orient="records"), + Series, + ), + Series, + ) + check( + assert_type( + read_json(s.to_json(orient="index"), typ="series", orient="index"), Series + ), + Series, + ) + check( + assert_type( + read_json(s.to_json(orient="table"), typ="series", orient="table"), Series + ), + Series, + ) def test_json_chunk():