-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Changes made for table iteration #26
Conversation
hi @tedivm black formatting issue fixed ! please review it |
We still need tests for the new functionality. |
For testing basically copy the Then tweak the command line arguments to use some regex patterns, before finally testing that the appropriate tables are present (or not present, as the case may be). |
Sure @tedivm thanks for your information 😊 |
Hi @tedivm test was successfully passed can i make a pr now ? |
Just push the new tests to this branch and this branch will automatically update and I can review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I provided some comments to help improve the tests.
tests/test_cli.py
Outdated
assert result.exit_code == 0 | ||
assert "regular_table {" not in result.stdout | ||
assert "first_test {" in result.stdout | ||
assert "second{" not in result.stdout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests don't make sense- I don't know where these strings are coming from. The goal here is to test that the proper columns exist, but the excluded ones do not.
In this case we have three tables- comments
, users
, and posts
. Since we're trying to include the pattern ^com.*
we expect the comments table to be in the diagram but not the other two.
assert "comments {" in result.stdout
assert "users {" not in result.stdout
assert "post {" not in result.stdout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I apologise @tedivm I'll make changes !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries! I appreciate you taking this on!
tests/test_cli.py
Outdated
assert "regular_table {" in result.stdout | ||
assert "first {" not in result.stdout | ||
assert "second {" in result.stdout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case we have three tables- comments
, users
, and posts
. Since we're trying to exclude the pattern ^pos.*
we expect the comments and users table to be in the diagram but not the posts one.
assert "comments {" in result.stdout
assert "users {" in result.stdout
assert "post {" not in result.stdout
hi @tedivm I have changed that useless strings, used regex pattern and tests passed. could you please tell me if there is any mistakes ? |
tests/test_cli.py
Outdated
"^com.*", | ||
"comments", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should remain ^com.*
, otherwise you aren't testing the regex.
tests/test_cli.py
Outdated
"pos.*", | ||
"^pos*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure this should be ^pos.*
It looks like when you updated the tests you removed the regex from them, but the whole point of these tests is to make sure the regex is actually used and works as expected. |
tests/test_cli.py
Outdated
from click.testing import CliRunner | ||
from paracelsus.cli import app | ||
|
||
from sqlalchemy import Column, Integer, String | ||
from sqlalchemy.ext.declarative import declarative_base | ||
|
||
Base = declarative_base() | ||
|
||
|
||
class Comments(Base): | ||
__tablename__ = "comments" | ||
id = Column(Integer, primary_key=True) | ||
text = Column(String) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't do this- use the existing test database, it works perfectly for this use case.
Also imports should never be here, always at the top of the file.
Sorry @tedivm , Now i made changes can you please review it ? |
Okay, so the tests themselves look good now. They're testing what we want to test. However, it looks like one of the tests is failing.
This error is showing that the |
Github won't let me make the comment inline, but on line 97 of the On line 92 you should also change I think with those two changes tests will pass. |
Actually I was wrong about line 92, it's probably just line 97 that needs the change. |
Good morning @tedivm, I have made changes |
It all works now! Thank you so much for contributing and working through the review process. |
Thank you @tedivm for merging my PR and supporting me during the process. I really value the collaboration and would love to stay connected. Looking forward to learning from you and contributing more in the future. |
Description
Initially the tables used a simple string method of matching. Now its updated to iteration method that iterates over the tables. previous error with the formatting also rectified.