scikit-learn-contrib / scikit-matter

A collection of scikit-learn compatible utilities that implement methods born out of the materials science and chemistry communities
https://scikit-matter.readthedocs.io/en/v0.2.0/
BSD 3-Clause "New" or "Revised" License
70 stars 18 forks source link

Fix indentation errors in tests #153

Closed victorprincipe closed 1 year ago

victorprincipe commented 1 year ago

In lots of the tests, an exception was caught as shown below, with an assertEqual to ensure that the error message matches what the exception that is caught:

with self.assertRaises(ValueError) as cm:
            _ = PCovFPS(n_to_select=1, mixing=1.0)
            self.assertEqual(
                str(cm.exception),
                "Mixing = 1.0 corresponds to traditional FPS." "Please use the FPS class.",
            )

However, when the exception is caught (at _ = PCovFPS(n_to_select=1, mixing=1.0) in the example above), the rest of the code in the with method does not execute, and so the assertEqual tests were not run.

I have fixed these indentation errors in the following manner, for the example above:

with self.assertRaises(ValueError) as cm:
            _ = PCovFPS(n_to_select=1, mixing=1.0)
self.assertEqual(
    str(cm.exception),
    "Mixing = 1.0 corresponds to traditional FPS." "Please use the FPS class.",
)

Once the code executed properly, I additionally fixed some tests that were not functioning properly or raising warnings. Examples of errors that led to failed tests/warnings include:

I also made some minor changes/typo fixes to error messages in the VoronoiFPS and SparseKernelCenterer classes.