Skip to content

Add scale param to images #266

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

Merged
merged 7 commits into from
Jul 27, 2015
Merged

Add scale param to images #266

merged 7 commits into from
Jul 27, 2015

Conversation

chriddyp
Copy link
Member

chriddyp added 4 commits July 24, 2015 17:56
if a user specifies ‘test.png’ as their filename, then don’t fuck with
that! now, we were changing that to `’test.png.png’` if they also
specified `format=‘png’`. sure, now they could set their filename
`test.png` and their format `jpeg`, but that is their fault.
this fixes the test, too.
arg_string = ', '.join([str(a) for a in args])
test_name = test_generator.__name__.replace('_generate', 'test')
test_name += '({})'.format(arg_string)
setattr(TestImage, test_name, _test)
Copy link
Member Author

Choose a reason for hiding this comment

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

this is so much fun.

autogenerating tests of all of the permutations of input arguments!

♡ nosetests plotly/tests/test_core/test_image/ --pdb -v
_test_image_get_returns_valid_image_test(jpeg, 300, 300, None) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(jpeg, 300, None, None) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(jpeg, None, 300, None) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(jpeg, None, None, None) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(pdf, 300, 300, None) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(pdf, 300, None, None) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(pdf, None, 300, None) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(pdf, None, None, None) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(png, 300, 300, 5) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(png, 300, 300, None) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(png, 300, None, 5) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(png, 300, None, None) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(png, None, 300, 5) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(png, None, 300, None) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(png, None, None, 5) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(png, None, None, None) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(svg, 300, 300, None) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(svg, 300, None, None) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(svg, None, 300, None) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok
_test_image_get_returns_valid_image_test(svg, None, None, None) (plotly.tests.test_core.test_image.test_image.TestImage) ... ok

heck yeah setattr. this line assigns test functions to the test class which unique names that start with test_ and therefore are run by nose!

chriddyp added 2 commits July 24, 2015 18:06
@BRONSOLO @theengineear - these endpoints return a 400 now?

```
test_duplicate_folders
(plotly.tests.test_core.test_file.test_file.FolderAPITestCase) ... ERROR

======================================================================
ERROR: test_duplicate_folders
(plotly.tests.test_core.test_file.test_file.FolderAPITestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/home/ubuntu/python-api/plotly/tests/test_core/test_file/test_file.py",
 line 45, in test_duplicate_folders
    py.file_ops.mkdirs(first_folder)
  File "/home/ubuntu/python-api/plotly/plotly/plotly.py", line 717, in
mkdirs
    _api_v2.response_handler(res)
  File "/home/ubuntu/python-api/plotly/plotly/plotly.py", line 1171, in
response_handler
    raise(plotly_exception)
PlotlyRequestError:
-------------------- >> begin captured logging << --------------------
requests.packages.urllib3.connectionpool: INFO: Starting new HTTPS
connection (1): api.plot.ly
requests.packages.urllib3.connectionpool: DEBUG: "POST /v2/folders
HTTP/1.1" 400 69
--------------------- >> end captured logging << ---------------------
```
@theengineear
Copy link
Contributor

@chriddyp , yup, it'd be best to test that it's 4xx for now.

@theengineear
Copy link
Contributor

this is sweet btw! 💃

@BRONSOLO
Copy link
Member

👍

@chriddyp
Copy link
Member Author

@theengineear @BRONSOLO - it's not supposed to be a 4xx though, it's supposed to be a 200!

chriddyp added a commit that referenced this pull request Jul 27, 2015
@chriddyp chriddyp merged commit 60a554d into master Jul 27, 2015
@chriddyp chriddyp deleted the add_scale_param branch July 27, 2015 15:33
@theengineear
Copy link
Contributor

@chriddyp sorry read that too fast, looking into it now (#266 (comment))

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.

3 participants