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

Type checking errors can fail for primitive types #437

Closed
thermokarst opened this issue Jan 30, 2019 · 0 comments · Fixed by #447
Closed

Type checking errors can fail for primitive types #437

thermokarst opened this issue Jan 30, 2019 · 0 comments · Fixed by #447
Assignees
Labels
bug-sev:1|negligible bug-type:2|workaround-req Progress can't be made in the usual way. lang:python Python 3 scope:3|all-projects All projects are impacted by this change. src:forum From the QIIME 2 Forum. type:bug Something is wrong.
Projects

Comments

@thermokarst
Copy link
Contributor

Bug Description
The type mismatch exception message uses QIIME 2 API specific to Artifacts (kwarg.type), which breaks down when kwarg is a primitive type (like float).

This bug was introduced in #417.

Steps to reproduce the behavior

import qiime2
from qiime2.plugins import metadata
md = qiime2.Metadata.load('some_md.tsv')
metadata.actions.tabulate(input=md, page_size=0.5). # page_size should be an int...
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-6-46d72e1c9e55> in <module>
----> 1 metadata.actions.tabulate(input=md, page_size=0.5)

<decorator-gen-338> in tabulate(input, page_size)

~/src/qiime2/qiime2/qiime2/sdk/action.py in bound_callable(*args, **kwargs)
    197
    198                 # Type management
--> 199                 self.signature.check_types(**user_input)
    200                 output_types = self.signature.solve_output(**user_input)
    201                 callable_args = {}

~/src/qiime2/qiime2/qiime2/core/type/signature.py in check_types(self, **kwargs)
    299                         "Parameter %r received an argument of type %r. An "
    300                         "argument of subtype %r is required." % (
--> 301                             name, kwargs[name].type, spec.qiime_type))
    302
    303     def solve_output(self, **input_types):

AttributeError: 'float' object has no attribute 'type'

Expected behavior
The exception should work for primitive types, too.

References

  1. Original forum post
@thermokarst thermokarst added type:bug Something is wrong. bug-sev:1|negligible bug-type:2|workaround-req Progress can't be made in the usual way. lang:python Python 3 scope:3|all-projects All projects are impacted by this change. src:forum From the QIIME 2 Forum. labels Jan 30, 2019
@thermokarst thermokarst added this to In Development in 2019.4 Mar 11, 2019
@thermokarst thermokarst moved this from In Development to In Progress - Supplanted Issues in 2019.4 Apr 9, 2019
2019.4 automation moved this from In Progress - Supplanted Issues to Completed Apr 15, 2019
@thermokarst thermokarst moved this from Completed to Changelog Needed in 2019.4 Apr 15, 2019
@thermokarst thermokarst moved this from Changelog Needed to In Progress - Supplanted Issues in 2019.4 Apr 15, 2019
@thermokarst thermokarst moved this from In Progress - Supplanted Issues to Completed in 2019.4 Apr 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-sev:1|negligible bug-type:2|workaround-req Progress can't be made in the usual way. lang:python Python 3 scope:3|all-projects All projects are impacted by this change. src:forum From the QIIME 2 Forum. type:bug Something is wrong.
Projects
No open projects
2019.4
  
Completed
Development

Successfully merging a pull request may close this issue.

2 participants