Skip to content

Commit

Permalink
Add unit tests to verify the container’s module
Browse files Browse the repository at this point in the history
Summary:
Add some unit tests to verify the container’s module
#buildall

Reviewed By: ahilger

Differential Revision: D68304174

fbshipit-source-id: ea72c94a0bf72ed03cfb04c1130dabade932a870
  • Loading branch information
Danfeng Wang authored and facebook-github-bot committed Jan 17, 2025
1 parent f6e222e commit 938fcfd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions third-party/thrift/src/thrift/lib/python/test/lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ def test_struct_list(self) -> None:
self.assertLessEqual(a, c)
self.assertGreaterEqual(c, e)

def test_list_module_name(self) -> None:
easy_list = self.EasyList([self.easy()])
self.assertEqual(easy_list.__class__.__module__, "thrift.python.types")

def test_struct_with_list_fields(self) -> None:
s = self.Lists(
# pyre-ignore[6]: TODO: Thrift-Container init
Expand Down
4 changes: 4 additions & 0 deletions third-party/thrift/src/thrift/lib/python/test/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ def test_adapted_maps(self) -> None:

self.assertEqual(the_map, self.StrAtoIValueMap(the_map))

def test_map_module_name(self) -> None:
easy_map = self.StrEasyMap({"a": self.easy()})
self.assertEqual(easy_map.__class__.__module__, "thrift.python.types")


# TODO: Collapse these two test cases into parameterized test above
class MapImmutablePythonTests(unittest.TestCase):
Expand Down
4 changes: 4 additions & 0 deletions third-party/thrift/src/thrift/lib/python/test/sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ def test_struct_set(self) -> None:
self.assertGreaterEqual(a, d)
self.assertGreaterEqual(f, a)

def test_set_module_name(self) -> None:
easy_set = EasySet({easy()})
self.assertEqual(easy_set.__class__.__module__, "thrift.python.types")


# TODO: Collapse these two test cases into parameterized test above
class SetImmutablePythonTests(unittest.TestCase):
Expand Down

0 comments on commit 938fcfd

Please sign in to comment.