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

Add black fmt: off tags to test n-dimensional arrays #201

Closed
ljvmiranda921 opened this issue Aug 10, 2018 · 2 comments
Closed

Add black fmt: off tags to test n-dimensional arrays #201

ljvmiranda921 opened this issue Aug 10, 2018 · 2 comments
Assignees
Labels
bug Bugs, bug fixes, etc. unit tests Test-related changes v.1.1.0 In pipeline for next version

Comments

@ljvmiranda921
Copy link
Owner

Describe the bug
The problem is that whenever we have a multidimensional array for test-cases, black formats them
"vertically", resulting to a very high LOC and uglier code. See this issue

To Reproduce

$ black tests/
$ vim tests/backend/topology/test_von_neumann.py

Then check test_delannoy_numbers and observe how the n-dim array is formatted.

Expected behavior

It's better to retain the current formatting.

Environment (please complete the following information):

  • OS: [e.g. Linux] Linux
  • Version [e.g. Ubuntu 16.04] Ubuntu 16.04
  • PySwarms Version [e.g. v.0.2.0] v.0.3.0
  • Python Version [e.g. 3.6.X] 3.6.X

Additional context

We can easily solve this by using fmt: off followed by # fmt: on on specific parts of the code. However, we also need to identify parts of the code where we need to use this formatting.

@ljvmiranda921 ljvmiranda921 added bug Bugs, bug fixes, etc. unit tests Test-related changes v.1.1.0 In pipeline for next version labels Aug 10, 2018
@ljvmiranda921 ljvmiranda921 self-assigned this Aug 10, 2018
@whzup
Copy link
Collaborator

whzup commented Aug 13, 2018

To be honest this looks like a really ugly solution to me 😕. This would be better off as an option in the black module instead of something that has to be done manually.

@ljvmiranda921
Copy link
Owner Author

For now this is what we can only do. Using external files to export our predefined numpy arrays seems to convolute everything. Unless there's a better way to remove the n-dimensional arrays that we have, maybe hypothesis can make our predefined arrays more generalized (and reproducible?)

@whzup whzup mentioned this issue Aug 16, 2018
9 tasks
ljvmiranda921 pushed a commit that referenced this issue Aug 17, 2018
Resolves: #201

Added fmt: off and fmt: on commments to n-dimensional arrays in the test suite to prevent the ugly wrapping of arrays. Ran the black package to format the whole project.
ljvmiranda921 pushed a commit that referenced this issue Jan 29, 2019
Resolves: #201

Added fmt: off and fmt: on commments to n-dimensional arrays in the test suite to prevent the ugly wrapping of arrays. Ran the black package to format the whole project.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs, bug fixes, etc. unit tests Test-related changes v.1.1.0 In pipeline for next version
Projects
None yet
Development

No branches or pull requests

2 participants