Skip to content

[#3818][#4100] Improvement(client-python): Replace all assert in client-python & fix: Validate methods of request in client-python are not correct#4346

Merged
jerryshao merged 11 commits intoapache:mainfrom
jingjia88:dev2
Aug 17, 2024

Conversation

@jingjia88
Copy link
Contributor

@jingjia88 jingjia88 commented Aug 3, 2024

What changes were proposed in this pull request?

  • Fix validate errors (attributes are not allowed to be None) in catalog_update_request.py .
  • Unify the implementation way of validate : using raise.
  • Replace all assert with defined exception.

Why are the changes needed?

Fix: #3818, #4100

Does this PR introduce any user-facing change?

No.

How was this patch tested?

test with ./gradlew client:client-python:test

@mchades mchades requested a review from xunliu August 5, 2024 02:04
@jerryshao
Copy link
Contributor

@noidname01 would you please help to review this?

@noidname01
Copy link
Collaborator

@jingjia88 I think you can also try to solve #4100 in this PR, which shares some problems with this issue.

@jerryshao
Copy link
Contributor

@jingjia88 would you please fix the conflicts and continue the work as @noidname01 mentioned, thanks.

@jingjia88
Copy link
Contributor Author

@jerryshao Sure, I'll work on it.

@jerryshao
Copy link
Contributor

We're planning to kick off the 0.6.0 release this week, hopes this can be done this week @jingjia88 , thanks a lot.

@jingjia88 jingjia88 changed the title [#3818] fix: Validate methods of request in client-python are not correct [#3818][#4100] Improvement(client-python): Replace all assert in client-python & fix: Validate methods of request in client-python are not correct Aug 13, 2024
@jingjia88
Copy link
Contributor Author

@noidname01 I’ve addressed issue #4100 in this PR as well. Could you please review the modifications? Thank you!

@noidname01
Copy link
Collaborator

@noidname01 I’ve addressed issue #4100 in this PR as well. Could you please review the modifications? Thank you!

@jingjia88 Sure, I'll review it ASAP.

Copy link
Collaborator

@noidname01 noidname01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for minor issues, LGTM

assert self.audit_info() is not None, "audit must not be None"
if self.rest_client is None:
raise IllegalArgumentException("restClient must be set")
if not (self.name() and len(self.name().strip()) > 0):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here can modify into if not self.name() or not self.name.strip()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

raise IllegalArgumentException("name must not be blank")
if self.type() is None:
raise IllegalArgumentException("type must not be None")
if not (self.provider() and len(self.provider().strip()) > 0):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@jerryshao
Copy link
Contributor

@noidname01 can you please take another review when you have time, thanks!

Generally the PR looks good to me.

@jerryshao jerryshao merged commit 300452b into apache:main Aug 17, 2024
github-actions bot pushed a commit that referenced this pull request Aug 17, 2024
…nt-python & fix: Validate methods of request in client-python are not correct (#4346)

### What changes were proposed in this pull request?

- Fix `validate` errors (attributes are not allowed to be None) in
`catalog_update_request.py` .
- Unify the implementation way of `validate` : using raise. 
- Replace all `assert` with defined exception.

### Why are the changes needed?

Fix: #3818
Fix: #4100 

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

test with` ./gradlew client:client-python:test`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug report] Validate methods of request in client-python are not correct

3 participants