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

PR: Added Matlab files import tests #4102

Merged
merged 12 commits into from
Feb 8, 2017

Conversation

andfoy
Copy link
Member

@andfoy andfoy commented Feb 4, 2017

Fixes #4076
This test allows to confirm and validate the main datatypes defined in MATLAB, including:

  • Scalar numbers
  • Vectors/Matrices
  • Structs
  • Strings
  • Cell Arrays
  • Complex values

@andfoy andfoy added this to the v3.1.3 milestone Feb 4, 2017
@andfoy andfoy self-assigned this Feb 4, 2017
@goanpeca
Copy link
Member

goanpeca commented Feb 4, 2017

Looking good :-), ping when its done for review

@andfoy
Copy link
Member Author

andfoy commented Feb 4, 2017

@goanpeca This PR is ready to go!
PS: There's an unrelated error to this PR while testing on Travis

@ccordoba12
Copy link
Member

Yep, our Travis tests are failing because of a new release of Jedi. I'll fix it right away ;-)

@ccordoba12 ccordoba12 changed the title PR: Added MATLAB importation tests PR: Added Matlab files import tests Feb 4, 2017
inf, _ = io.load_matlab(path)
valid = True
for var in sorted(real_values.keys()):
valid = valid and np.sum(real_values[var] == inf[var])
Copy link
Member

Choose a reason for hiding this comment

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

Why are you using np.sum here?

import numpy as np
import spyder.utils.iofuncs as io

__location__ = os.path.realpath(os.path.join(os.getcwd(),
Copy link
Member

Choose a reason for hiding this comment

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

Make this a constant, i.e. LOCATION

@@ -13,13 +13,25 @@
import numpy as np
import spyder.utils.iofuncs as io

__location__ = os.path.realpath(os.path.join(os.getcwd(),
LOCATION = os.path.realpath(os.path.join(os.getcwd(),
os.path.dirname(__file__)))
Copy link
Member

Choose a reason for hiding this comment

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

Please align this line correctly to be at the same level of os.getcwd() above.

os.path.dirname(__file__)))


@pytest.fixture
def real_values():
path = os.path.join(__location__, 'numpy_data.npz')
"""
Loads a Numpy pickled file.
Copy link
Member

Choose a reason for hiding this comment

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

Loads -> Load

over several variable types, such as: Matrices/Vectors, Scalar and
Complex numbers, Structs, Strings and Cell Arrays. The set of variables
was defined to allow and test the deep conversion of a compound type,
i.e., A struct that contains other types that need to be converted,
Copy link
Member

Choose a reason for hiding this comment

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

typo: i.e. a struct


This test loads a file stored in MATLAB, the variables defined are
equivalent to the manually converted values done over Numpy. This test
allows to evaluate the function which processes the conversion automa
Copy link
Member

Choose a reason for hiding this comment

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

automa -> automa-

@ccordoba12 ccordoba12 merged commit af0d87d into spyder-ide:3.1.x Feb 8, 2017
ccordoba12 added a commit that referenced this pull request Feb 8, 2017
ccordoba12 added a commit that referenced this pull request Feb 8, 2017
@andfoy andfoy deleted the matlab_import_test branch June 14, 2019 19:10
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