Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo _dumo_json #90

Merged
merged 1 commit into from
Dec 28, 2023
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
4 changes: 2 additions & 2 deletions sdgx/cli/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 1 addition & 2 deletions sdgx/data_models/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
6 changes: 3 additions & 3 deletions tests/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
4 changes: 2 additions & 2 deletions tests/cli/test_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand Down