-
Notifications
You must be signed in to change notification settings - Fork 80
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
Add cli for description #259
base: main
Are you sure you want to change the base?
Conversation
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.
Thanks! This is great so far. Please add unit tests for these. 🙂
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.
Looking good so far. Please also add another test case for edit
ing the description too.
Thanks! 🙂
Please tell me that there is any problem in |
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.
Looking good. Just a few minor tweaks.
tests/test_cli.py
Outdated
def test_edit_description(runner, todos, todo_factory): | ||
todo_factory(summary='harhar\n', description='Parnidi') | ||
|
||
result = runner.invoke(cli, ['edit', '1', '--description', 'Parnidi']) |
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.
When editing the todo, set the description to something different than the original value. Otherwise it's unclear if the edit
did anything or not.
tests/test_cli.py
Outdated
|
||
|
||
def test_edit_description(runner, todos, todo_factory): | ||
todo_factory(summary='harhar\n', description='Parnidi') |
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 need for the \n
here.
@@ -652,6 +653,9 @@ def todos(self, lists=(), priority=None, location='', category='', grep='', | |||
if priority: | |||
extra_where.append('AND PRIORITY > 0 AND PRIORITY <= ?') | |||
params.append('{}'.format(priority)) | |||
if description: |
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.
Oh, also, no tests seem to cover this new filter.
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.
Sorry, I think this filter does not do anything. so, I remove it.
@@ -466,6 +468,8 @@ def move(ctx, list, ids): | |||
@cli.command() | |||
@pass_ctx | |||
@click.argument('lists', nargs=-1, callback=_validate_lists_param) | |||
@click.option('--description', |
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.
Since you deleted the implementation for this flag, the flag should be removed too.
Note that that implementation was not wrong; just missing tests though.
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 really don't understand which tests are missing.
And if I remove the flag then also it works correctly then why that implementation was not wrong.
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 flag was used here. By deleting that bit of code, this flag is now unused and ignored.
My initial comment on that related bit of code was that there were no tests for it (though the code itself seemed fine). Basically, that would be a test that uses runner
with 'list', '--description'
.
You can either remove the flag (now unused), or undelete that code and add tests for it (I'm very much prefer the latter, of course. 🙂 ).
can you please tell me where should I add these tests.( from test_model.py
or test_cli.py)
…On Tue, Jun 20, 2017 at 2:44 PM, Hugo Osvaldo Barrera < ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In todoman/cli.py
<#259 (comment)>:
> @@ -466,6 +468,8 @@ def move(ctx, list, ids):
@cli.command()
@pass_ctx
@click.argument('lists', nargs=-1, callback=_validate_lists_param)
***@***.***('--description',
This flag was used here
<09fcd21#diff-d7b704f0d282081b24d6d106d9ea528fL656>.
By deleting that bit of code, this flag is now unused and ignored.
My initial comment on that related bit of code was that there were no
tests for it (though the code itself seemed fine). Basically, that would be
a test that uses runner with 'list', '--description'.
You can either remove the flag (now unused), or undelete that code and add
tests for it (I'm very much prefer the latter, of course. 🙂 ).
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#259 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AXknkfySDlmU5I95-bV5tf0Pn-kKJeFwks5sGBMZgaJpZM4N9dDs>
.
--
Anubha Agrawal,
Sophomore year B.tech,
Computer Science Department
Zakir Hussain College of Engineering & Technology, AMU
|
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.
Looking good. Just one final improvement and we're good to go.
tests/test_cli.py
Outdated
assert 'Kimple' in result.output | ||
|
||
|
||
def test_filter_description(runner, create): |
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.
Please also a second todo
to this test case that is NOT included in the result (eg: one that has a descripcion that doesn't contain 'Kimple'). That way, we can make sure we're not showing todos that don't match the filtering criteria.
) | ||
result = runner.invoke(cli, ['list']) | ||
|
||
assert 'Shubik' in result.output |
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.
Also, assert that the other todo is not in result.output
. You'll want to give them different summaries to tell them apart.
can you please tell me that is any other change is required?? |
Looks like this comment hasn't been addressed yet. |
Solve #240 for description