Skip to content

Fix invalid assert.throws statements#419

Merged
steveoni merged 4 commits into
javascriptdata:devfrom
igonro:i416-fix-assert-throws-statements
Jul 29, 2022
Merged

Fix invalid assert.throws statements#419
steveoni merged 4 commits into
javascriptdata:devfrom
igonro:i416-fix-assert-throws-statements

Conversation

@igonro

@igonro igonro commented Mar 8, 2022

Copy link
Copy Markdown
Contributor

Closes #416.

  • Fix invalid assert.throws statements
  • Run the tests again and check that the tests passed

To review: @risenW @steveoni

@igonro

igonro commented Mar 8, 2022

Copy link
Copy Markdown
Contributor Author

After fixing the invalid assert.throws, some of the node tests are not passing. This is the output:

  707 passing (965ms)
  2 failing

  1) DataFrame
       addColumn
         throw error for wrong column length:

      AssertionError: expected [Function] to throw error including 'ParamError: Column data length mismatch. You provided data with length 3 but Ndframe has column of length 4' but got 'ParamError: Column data length mismatch. You provided data with length 3 but Ndframe has column of length 3'
      + expected - actual

      -ParamError: Column data length mismatch. You provided data with length 3 but Ndframe has column of length 3
      +ParamError: Column data length mismatch. You provided data with length 3 but Ndframe has column of length 4

      at Context.<anonymous> (test/core/frame.test.ts:131:20)
      at processImmediate (internal/timers.js:464:21)

  2) Generic (NDFrame)
       NDframe Created from Array
         Throws error on duplicate index:

      AssertionError: expected [Function] to throw error including 'IndexError: Row index must contain unique values' but got 'IndexError: You provided an index of length 3 but Ndframe rows has length of 2'
      + expected - actual

      -IndexError: You provided an index of length 3 but Ndframe rows has length of 2
      +IndexError: Row index must contain unique values

      at Context.<anonymous> (test/core/generic.test.ts:72:20)
      at processImmediate (internal/timers.js:464:21)
@igonro

igonro commented Mar 8, 2022

Copy link
Copy Markdown
Contributor Author

The same happens for some browser tests:

Chrome Headless 98.0.4758.102 (Linux x86_64) DataFrame addColumn throw error for wrong column length FAILED
        AssertionError: expected [Function] to throw error including 'ParamError: Column data length mismatch. You provided data with length 3 but Ndframe has column of length 4' but got 'ParamError: Column data length mismatch. You provided data with length 3 but Ndframe has column of length 3'
            at Context.<anonymous> (/tmp/7ad0f53a5cff4b52986a8d5fc061a919.browserify.js:151280:14)

Chrome Headless 98.0.4758.102 (Linux x86_64) Generic (NDFrame) NDframe Created from Array Throws error on duplicate index FAILED
        AssertionError: expected [Function] to throw error including 'IndexError: Row index must contain unique values' but got 'IndexError: You provided an index of length 3 but Ndframe rows has length of 2'
            at Context.<anonymous> (/tmp/7ad0f53a5cff4b52986a8d5fc061a919.browserify.js:154123:14)
@igonro

igonro commented Mar 8, 2022

Copy link
Copy Markdown
Contributor Author

I solved those errors. Now all the tests are passing! 🎉

I'm glad I casually found those assert.throws typos while working in #417, because they were hiding a little bug in the shared/errors.ts file, and other little bug in the tests of "Throws error on duplicate index" 😄

@igonro igonro marked this pull request as ready for review March 8, 2022 12:31
@risenW risenW requested review from risenW and steveoni March 9, 2022 07:39
Comment thread src/danfojs-browser/tests/core/frame.test.js
Comment thread src/danfojs-browser/tests/core/generic.test.js
@igonro

igonro commented Mar 9, 2022

Copy link
Copy Markdown
Contributor Author

Done! @steveoni
I did it for the js files. Maybe is needed for the ts files too(?)
I looked at some assert.throws, but the lint style is a bit different sometimes.

@igonro igonro requested a review from steveoni March 11, 2022 13:27
@steveoni steveoni merged commit b77662d into javascriptdata:dev Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants