From 12b8c99870687a6534c9855d49e0be3afea33bdf Mon Sep 17 00:00:00 2001 From: Wh1isper <9573586@qq.com> Date: Thu, 28 Dec 2023 22:31:55 +0800 Subject: [PATCH] Fix typo _dumo_json --- sdgx/cli/message.py | 4 ++-- sdgx/data_models/metadata.py | 3 +-- tests/cli/test_cli.py | 6 +++--- tests/cli/test_message.py | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/sdgx/cli/message.py b/sdgx/cli/message.py index 1fabad46..fe6fcbb6 100644 --- a/sdgx/cli/message.py +++ b/sdgx/cli/message.py @@ -8,11 +8,11 @@ class ExitMessage(BaseModel): msg: str payload: dict = {} - def _dumo_json(self) -> str: + def _dump_json(self) -> str: return self.model_dump_json() def send(self): - print(self._dumo_json(), flush=True, end="") + print(self._dump_json(), flush=True, end="") class NormalMessage(ExitMessage): diff --git a/sdgx/data_models/metadata.py b/sdgx/data_models/metadata.py index d8e57a7c..d2c74239 100644 --- a/sdgx/data_models/metadata.py +++ b/sdgx/data_models/metadata.py @@ -87,8 +87,7 @@ def from_dataloader( max_chunk(int): max chunk count. - primary_key(list(str) | str): the primary key of this table. - Use the first column in table by default. + primary_keys(list[str]): primary keys, see :class:`~sdgx.data_models.metadata.Metadata` for more details. include_inspectors(list[str]): data type inspectors that should included in this metadata (table). diff --git a/tests/cli/test_cli.py b/tests/cli/test_cli.py index 1fe938d0..933d271a 100644 --- a/tests/cli/test_cli.py +++ b/tests/cli/test_cli.py @@ -32,10 +32,10 @@ def test_list_extension_api(command, json_output): assert result.exit_code == 0 if json_output: - assert NormalMessage()._dumo_json() in result.output - assert NormalMessage()._dumo_json() == result.output.strip().split("\n")[-1] + assert NormalMessage()._dump_json() in result.output + assert NormalMessage()._dump_json() == result.output.strip().split("\n")[-1] else: - assert NormalMessage()._dumo_json() not in result.output + assert NormalMessage()._dump_json() not in result.output @pytest.mark.parametrize("model", ["CTGAN"]) diff --git a/tests/cli/test_message.py b/tests/cli/test_message.py index bdb5b46c..90ea1ec0 100644 --- a/tests/cli/test_message.py +++ b/tests/cli/test_message.py @@ -8,7 +8,7 @@ @pytest.mark.parametrize("return_val", [0, "123", [1, 2, 3], {"a": 1, "b": 2}]) def test_normal_message(return_val): - NormalMessage.from_return_val(return_val)._dumo_json == json.dumps( + NormalMessage.from_return_val(return_val)._dump_json == json.dumps( { "code": 0, "msg": "Success", @@ -31,7 +31,7 @@ def test_exception_message(exception_caller): exception_caller() except Exception as e: msg = ExceptionMessage.from_exception(e) - assert msg._dumo_json() + assert msg._dump_json() assert msg.code != 0 assert msg.payload assert "details" in msg.payload