Skip to content

Commit

Permalink
Fix the broken tests
Browse files Browse the repository at this point in the history
Summary: Fix the broken tests after adding `fbthrift_current_field` and `fbthrift_current_value` to thrift-python union

Reviewed By: Filip-F

Differential Revision: D63867616

fbshipit-source-id: 73af0b3558f42387d3923d9c5e733fdf034d973f
  • Loading branch information
yoney authored and facebook-github-bot committed Oct 4, 2024
1 parent be6821c commit 98b3d85
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions thrift/lib/py3/test/auto_migrate/unions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@

from folly.iobuf import IOBuf
from testing.types import Color, ComplexUnion, easy, Integers, IOBufUnion, ReservedUnion
from thrift.lib.py3.test.auto_migrate.auto_migrate_util import brokenInAutoMigrate
from thrift.lib.py3.test.auto_migrate.auto_migrate_util import (
brokenInAutoMigrate,
is_auto_migrated,
)
from thrift.py3.common import Protocol
from thrift.py3.serializer import deserialize
from thrift.py3.types import Union
Expand All @@ -31,17 +34,28 @@ def test_hashability(self) -> None:
hash(Integers())

def test_union_dir(self) -> None:
expected = [
"digits",
"large",
"medium",
"name_",
"small",
"tiny",
"type",
"unbounded",
"value",
]
expected = (
[
"digits",
]
+ (
# thrift-python added these to reduce the disparity between
# immutable and mutable union APIs.
["fbthrift_current_field", "fbthrift_current_value"]
if is_auto_migrated()
else []
)
+ [
"large",
"medium",
"name_",
"small",
"tiny",
"type",
"unbounded",
"value",
]
)
self.assertEqual(expected, dir(Integers()))
self.assertEqual(expected, dir(Integers))

Expand Down

0 comments on commit 98b3d85

Please sign in to comment.