Skip to content

Commit

Permalink
[JIT] Add test for ignored class type property (#45233)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #45233

**Summary**
This commit modifies `TestClassType.test_properties` to check that
properties on class types can be ignored with the same syntax as
ignoring properties on `Modules`.

**Test Plan**
`python test/test_jit.py TestClassType.test_properties`

Test Plan: Imported from OSS

Reviewed By: ZolotukhinM

Differential Revision: D23971885

Pulled By: SplitInfinity

fbshipit-source-id: f2228f61fe26dff219024668cc0444a2baa8834c
  • Loading branch information
Meghan Lele authored and facebook-github-bot committed Sep 29, 2020
1 parent 4af4b71 commit a0f0cb1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/jit/test_class_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -1167,13 +1167,19 @@ def free_function(x: int) -> int:

@torch.jit.script
class Properties(object):
__ignored_properties__ = ["unsupported"]

def __init__(self, a: int):
self.a = a

@property
def attr(self) -> int:
return self.a - 1

@property
def unsupported(self) -> int:
return sum([self.a])

@attr.setter
def attr(self, value: int):
self.a = value + 3
Expand Down

0 comments on commit a0f0cb1

Please sign in to comment.