Skip to content

Commit

Permalink
Move list / dict tests to TestList and TestDict (pytorch#22000)
Browse files Browse the repository at this point in the history
Summary:
There aren't any substantive changes aside from some test renames (e.g. `TestScript.test_dict_membership` -> `TestDict.test_membership`) and the addition of `TestDict.dict()`.

Adding the rest of the dict ops was making the tests a mess and `TestScript` is already > 10000 lines by itself, so breaking them up should make things cleaner
](https://our.intern.facebook.com/intern/diff/15911383/)
Pull Request resolved: pytorch#22000

Pulled By: driazati

Differential Revision: D15911383

fbshipit-source-id: 614428e03fbc14252f0e9cde74ab9a707169a860
  • Loading branch information
davidriazati authored and facebook-github-bot committed Jun 20, 2019
1 parent 0702b5f commit 6bd58b7
Show file tree
Hide file tree
Showing 2 changed files with 9,420 additions and 9,414 deletions.
20 changes: 20 additions & 0 deletions test/jit_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,26 @@ def run_pass(self, name, trace):
trace.set_graph(graph)
return graph

def checkScriptRaisesRegex(self, script, inputs, exception, regex,
optimize=True, outputs=None, capture_output=False):
"""
Checks that a given function will throw the correct exception,
when executed with normal python, the string frontend, and the AST frontend
"""
# normal python
with self.assertRaisesRegex(exception, regex):
script(*inputs)
# string frontend
with self.assertRaisesRegex(exception, regex):
source = textwrap.dedent(inspect.getsource(script))
cu = torch.jit.CompilationUnit(source, optimize)
ge = getattr(cu, script.__name__)
ge(*inputs)
# python AST frontend
with self.assertRaisesRegex(exception, regex):
ge = torch.jit.script(script, optimize)
ge(*inputs)

def checkScript(self,
script,
inputs,
Expand Down
Loading

0 comments on commit 6bd58b7

Please sign in to comment.