Skip to content

Commit

Permalink
Enable pyre-strict for enum tests
Browse files Browse the repository at this point in the history
Summary: Enable pyre-struct and fix the type-errors.

Reviewed By: ahilger, thedavekwon

Differential Revision: D64668396

fbshipit-source-id: e068632505173212ac4d6b77b73bf0fa64cd26f4
  • Loading branch information
yoney authored and facebook-github-bot committed Oct 21, 2024
1 parent 261e183 commit 51b7787
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions thrift/test/thrift-python/enum_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# pyre-strict

import types
import unittest

import thrift.test.thrift_python.enum_test.thrift_mutable_types as mutable_types # @manual=//thrift/test/thrift-python:enum_test_thrift-python-types
Expand All @@ -26,7 +29,7 @@ def setUp(self) -> None:
self.maxDiff = None

@parameterized.expand([immutable_types, mutable_types])
def test_enum_default(self, test_types) -> None:
def test_enum_default(self, test_types: types.ModuleType) -> None:
self.assertEqual(0, test_types.PositiveNumber.NONE)
self.assertEqual(1, test_types.PositiveNumber.ONE)

Expand All @@ -38,7 +41,7 @@ def test_enum_default(self, test_types) -> None:
self.assertEqual([], s.color_list)

@parameterized.expand([immutable_types, mutable_types])
def test_enum_initialize(self, test_types) -> None:
def test_enum_initialize(self, test_types: types.ModuleType) -> None:
s = test_types.TestStruct(
number=test_types.PositiveNumber.TWO,
number_list=[
Expand All @@ -58,7 +61,7 @@ def test_enum_initialize(self, test_types) -> None:
self.assertEqual([test_types.Color.blue, test_types.Color.blue], s.color_list)

@parameterized.expand([mutable_types])
def test_enum_update(self, test_types) -> None:
def test_enum_update(self, test_types: types.ModuleType) -> None:
s = test_types.TestStruct()

self.assertEqual(test_types.PositiveNumber.NONE, s.number)
Expand Down

0 comments on commit 51b7787

Please sign in to comment.