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

FunctionTestCase for function tests #3499

Merged
merged 10 commits into from
Jan 22, 2019

Conversation

niboshi
Copy link
Member

@niboshi niboshi commented Oct 5, 2017

This is an attempt to ease writing tests for functions.

Required methods

When you write a new function, you need to write 3 things in the corresponding test:

  • forward: Forward implementation which simply calls the new function.
  • forward_expected: Forward reference implementation that returns the expected outputs.
  • generate_inputs: Generates input arrays to test.

Test case class attributes (optional)

  • skip_forward_test: If True, forward test will be skipped.
  • skip_backward_test: If True, backward test will be skipped.
  • skip_double_backward_test: If True, double-backward test will be skipped.
  • dodge_nondifferentiable: If True, backward/double-backward tests check for non-differentiable error and retry until differentiable inputs are finally sampled.
  • contiguous: Contiguousness of incoming arrays. None: noncontiguous (default), 'C': C-contiguous.

Environment variables

(this feature has been removed from this PR)

To easily check numerical stability, the following environment variables can be used (set large number to repeatedly run the corresponding test)

  • CHAINER_TEST_FORWARD_REPEAT
  • CHAINER_TEST_BACKWARD_REPEAT
  • CHAINER_TEST_DOUBLE_BACKWARD_REPEAT

PR dependency:

@niboshi niboshi added cat:enhancement Implementation that does not break interfaces. cat:test Test or CI related. cat:feature Implementation that introduces new interfaces. and removed cat:enhancement Implementation that does not break interfaces. labels Oct 5, 2017
@niboshi niboshi force-pushed the test-function-template branch 8 times, most recently from f14de17 to 0ef66eb Compare October 12, 2017 04:05
@niboshi niboshi added the st:blocked-by-another-pr State indicating that another ticket is preventing this ticket from being closed/merged. label Oct 12, 2017
@niboshi niboshi force-pushed the test-function-template branch 11 times, most recently from f1a23c1 to d70c772 Compare October 16, 2017 23:37
@niboshi niboshi force-pushed the test-function-template branch 2 times, most recently from 323b2d1 to cf82cb5 Compare October 26, 2017 09:27
@niboshi niboshi changed the title [WIP] Function test template Function test template Oct 26, 2017
@chainer-ci
Copy link
Member

Jenkins CI test (for commit b0cc148, target branch master) succeeded!

@asi1024
Copy link
Member

asi1024 commented Jan 22, 2019

Rebased. Jenkins, test this please.

@chainer-ci
Copy link
Member

Jenkins CI test (for commit 212441e, target branch master) succeeded!

@asi1024
Copy link
Member

asi1024 commented Jan 22, 2019

Jenkins, test this please.

@chainer-ci
Copy link
Member

Jenkins CI test (for commit 8774fad, target branch master) succeeded!

@niboshi
Copy link
Member Author

niboshi commented Jan 22, 2019

LGTM

@niboshi niboshi modified the milestones: Future Task, v6.0.0b2 Jan 22, 2019
@niboshi niboshi changed the title Function test decorator FunctionTestCase for function tests Jan 22, 2019
@niboshi niboshi merged commit 12535b6 into chainer:master Jan 22, 2019
@niboshi niboshi deleted the test-function-template branch January 22, 2019 11:23
@hvy hvy removed their assignment Jan 23, 2019
@chainer-ci
Copy link
Member

Jenkins CI test (for commit 8774fad, target branch master) failed with status FAILURE.
(For contributors, please wait until the reviewer confirms the details of the error.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:test Test or CI related.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants