Skip to content

Commit

Permalink
Simplify test case names in proto_placeholder_test.py
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 622768288
  • Loading branch information
tfx-copybara committed Apr 8, 2024
1 parent f0c8140 commit 59ae2c5
Showing 1 changed file with 40 additions and 40 deletions.
80 changes: 40 additions & 40 deletions tfx/dsl/placeholder/proto_placeholder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,17 @@ def parse_text_proto(
# at pipeline runtime. There are additional DSL-only test cases in
# ./placeholder_test.py and additional resolution-only test cases in
# dsl/compiler/placeholder_utils_test.py
class ProtoPlaceholderTest(tf.test.TestCase):
class MakeProtoPlaceholderTest(tf.test.TestCase):

def testMakeProtoPlaceholder_Empty(self):
def test_Empty(self):
self.assertEqual(
'',
resolve(
ph.make_proto(execution_invocation_pb2.ExecutionInvocation())
),
)

def testMakeProtoPlaceholder_BaseOnly(self):
def test_BaseOnly(self):
actual = resolve(
ph.make_proto(
execution_invocation_pb2.ExecutionInvocation(tmp_dir='/foo')
Expand All @@ -96,7 +96,7 @@ def testMakeProtoPlaceholder_BaseOnly(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_FieldOnly(self):
def test_FieldOnly(self):
actual = resolve(_ExecutionInvocation(tmp_dir='/foo'))
self.assertProtoEquals(
"""
Expand All @@ -105,7 +105,7 @@ def testMakeProtoPlaceholder_FieldOnly(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_ScalarFieldTypes(self):
def test_ScalarFieldTypes(self):
def _resolve_and_parse(p: ph.Placeholder) -> metadata_store_pb2.Value:
return parse_text_proto(resolve(p), metadata_store_pb2.Value)

Expand All @@ -127,7 +127,7 @@ def _resolve_and_parse(p: ph.Placeholder) -> metadata_store_pb2.Value:
_resolve_and_parse(_MetadataStoreValue(bool_value=True)),
)

def testMakeProtoPlaceholder_EnumField(self):
def test_EnumField(self):
actual = resolve(
_UpdateOptions(reload_policy=pipeline_pb2.UpdateOptions.PARTIAL)
)
Expand All @@ -138,7 +138,7 @@ def testMakeProtoPlaceholder_EnumField(self):
parse_text_proto(actual, pipeline_pb2.UpdateOptions),
)

def testMakeProtoPlaceholder_FieldPlaceholder(self):
def test_FieldPlaceholder(self):
actual = resolve(
_ExecutionInvocation(tmp_dir=ph.execution_invocation().pipeline_run_id)
)
Expand All @@ -149,7 +149,7 @@ def testMakeProtoPlaceholder_FieldPlaceholder(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_EnumStringPlaceholder(self):
def test_EnumStringPlaceholder(self):
actual = resolve(
_UpdateOptions(reload_policy=ph.exec_property('reload_policy')),
exec_properties={'reload_policy': 'ALL'},
Expand All @@ -161,7 +161,7 @@ def testMakeProtoPlaceholder_EnumStringPlaceholder(self):
parse_text_proto(actual, pipeline_pb2.UpdateOptions),
)

def testMakeProtoPlaceholder_EnumIntPlaceholder(self):
def test_EnumIntPlaceholder(self):
actual = resolve(
_UpdateOptions(reload_policy=ph.exec_property('reload_policy')),
exec_properties={'reload_policy': 1},
Expand All @@ -173,7 +173,7 @@ def testMakeProtoPlaceholder_EnumIntPlaceholder(self):
parse_text_proto(actual, pipeline_pb2.UpdateOptions),
)

def testMakeProtoPlaceholder_EmptyFieldPlaceholder(self):
def test_EmptyFieldPlaceholder(self):
actual = resolve(
_ExecutionInvocation(tmp_dir=ph.execution_invocation().frontend_url)
)
Expand All @@ -184,17 +184,17 @@ def testMakeProtoPlaceholder_EmptyFieldPlaceholder(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_NoneIntoOptionalField(self):
def test_NoneIntoOptionalField(self):
actual = resolve(_ExecutionInvocation(tmp_dir=None))
self.assertProtoEquals('', parse_text_proto(actual))

def testMakeProtoPlaceholder_NonePlaceholderIntoOptionalField(self):
def test_NonePlaceholderIntoOptionalField(self):
actual = resolve(
_ExecutionInvocation(tmp_dir=ph.execution_invocation().frontend_url)
)
self.assertProtoEquals('', parse_text_proto(actual))

def testMakeProtoPlaceholder_NoneExecPropIntoOptionalField(self):
def test_NoneExecPropIntoOptionalField(self):
# When an exec prop has type Union[T, None] and the user passes None, it is
# actually completely absent from the exec_properties dict in
# ExecutionInvocation.
Expand All @@ -207,7 +207,7 @@ def testMakeProtoPlaceholder_NoneExecPropIntoOptionalField(self):
parse_text_proto(actual, pipeline_pb2.UpdateOptions),
)

def testMakeProtoPlaceholder_BareSubmessage(self):
def test_BareSubmessage(self):
actual = resolve(
_ExecutionInvocation(
pipeline_info=pipeline_pb2.PipelineInfo(id='foo-id')
Expand All @@ -222,7 +222,7 @@ def testMakeProtoPlaceholder_BareSubmessage(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_SubmessageDict(self):
def test_SubmessageDict(self):
actual = resolve(_ExecutionInvocation(pipeline_info=dict(id='foo-id')))
self.assertProtoEquals(
"""
Expand All @@ -233,7 +233,7 @@ def testMakeProtoPlaceholder_SubmessageDict(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_SubmessageMakeProtoPlaceholder(self):
def test_SubmessageMakeProtoPlaceholder(self):
actual = resolve(
_ExecutionInvocation(
pipeline_info=ph.make_proto(
Expand All @@ -251,7 +251,7 @@ def testMakeProtoPlaceholder_SubmessageMakeProtoPlaceholder(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_SubmessageProtoGetterPlaceholder(self):
def test_SubmessageProtoGetterPlaceholder(self):
actual = resolve(
_ExecutionInvocation(
pipeline_info=ph.execution_invocation().pipeline_info
Expand All @@ -266,7 +266,7 @@ def testMakeProtoPlaceholder_SubmessageProtoGetterPlaceholder(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_SubmessageOverwrite(self):
def test_SubmessageOverwrite(self):
actual = resolve(
ph.make_proto(
execution_invocation_pb2.ExecutionInvocation(
Expand All @@ -289,11 +289,11 @@ def testMakeProtoPlaceholder_SubmessageOverwrite(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_NoneIntoSubmessage(self):
def test_NoneIntoSubmessage(self):
actual = resolve(_ExecutionInvocation(pipeline_info=None))
self.assertProtoEquals('', parse_text_proto(actual))

def testMakeProtoPlaceholder_EmptyPlaceholderIntoSubmessage(self):
def test_EmptyPlaceholderIntoSubmessage(self):
actual = resolve(
_ExecutionInvocation(
pipeline_node=ph.execution_invocation().pipeline_node
Expand All @@ -306,7 +306,7 @@ def testMakeProtoPlaceholder_EmptyPlaceholderIntoSubmessage(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_RepeatedField(self):
def test_RepeatedField(self):
actual = resolve(
ph.make_proto(
execution_invocation_pb2.ExecutionInvocation(
Expand Down Expand Up @@ -335,7 +335,7 @@ def testMakeProtoPlaceholder_RepeatedField(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_RepeatedFieldSingleItem(self):
def test_RepeatedFieldSingleItem(self):
actual = resolve(
_ExecutionInvocation(
pipeline_node=ph.make_proto(
Expand All @@ -355,7 +355,7 @@ def testMakeProtoPlaceholder_RepeatedFieldSingleItem(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_RepeatedFieldFalsyItem(self):
def test_RepeatedFieldFalsyItem(self):
actual = resolve(
ph.make_proto(
execution_invocation_pb2.ExecutionInvocation(
Expand All @@ -379,13 +379,13 @@ def testMakeProtoPlaceholder_RepeatedFieldFalsyItem(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_NoneIntoRepeatedField(self):
def test_NoneIntoRepeatedField(self):
actual = resolve(
ph.make_proto(pipeline_pb2.PipelineNode(), upstream_nodes=None)
)
self.assertProtoEquals('', parse_text_proto(actual))

def testMakeProtoPlaceholder_EmptyPlaceholderListIntoRepeatedField(self):
def test_EmptyPlaceholderListIntoRepeatedField(self):
actual = resolve(
ph.make_proto(
pipeline_pb2.PipelineNode(),
Expand All @@ -394,15 +394,15 @@ def testMakeProtoPlaceholder_EmptyPlaceholderListIntoRepeatedField(self):
)
self.assertProtoEquals('', parse_text_proto(actual))

def testMakeProtoPlaceholder_EmptyListPlaceholderIntoRepeatedField(self):
def test_EmptyListPlaceholderIntoRepeatedField(self):
actual = resolve(
ph.make_proto(
pipeline_pb2.PipelineNode(), upstream_nodes=ph.make_list([])
)
)
self.assertProtoEquals('', parse_text_proto(actual))

def testMakeProtoPlaceholder_RepeatedSubmessage(self):
def test_RepeatedSubmessage(self):
actual = resolve(
ph.make_proto(
pipeline_pb2.StructuralRuntimeParameter(),
Expand All @@ -429,7 +429,7 @@ def testMakeProtoPlaceholder_RepeatedSubmessage(self):
parse_text_proto(actual, pipeline_pb2.StructuralRuntimeParameter),
)

def testMakeProtoPlaceholder_AnySubmessageBareMessage(self):
def test_AnySubmessageBareMessage(self):
actual = resolve(
_MetadataStoreValue(
proto_value=pipeline_pb2.PipelineNode(
Expand All @@ -449,7 +449,7 @@ def testMakeProtoPlaceholder_AnySubmessageBareMessage(self):
parse_text_proto(actual, metadata_store_pb2.Value),
)

def testMakeProtoPlaceholder_AnySubmessagePlaceholder(self):
def test_AnySubmessagePlaceholder(self):
actual = resolve(
_MetadataStoreValue(
# We can directly assign a message of any type and it will pack it.
Expand All @@ -472,7 +472,7 @@ def testMakeProtoPlaceholder_AnySubmessagePlaceholder(self):
parse_text_proto(actual, metadata_store_pb2.Value),
)

def testMakeProtoPlaceholder_NonePlaceholderIntoAnySubmessage(self):
def test_NonePlaceholderIntoAnySubmessage(self):
actual = resolve(
_MetadataStoreValue(proto_value=ph.execution_invocation().pipeline_node)
)
Expand All @@ -485,7 +485,7 @@ def testMakeProtoPlaceholder_NonePlaceholderIntoAnySubmessage(self):
parse_text_proto(actual, metadata_store_pb2.Value),
)

def testMakeProtoPlaceholder_MapFieldScalarValue(self):
def test_MapFieldScalarValue(self):
actual = resolve(
_ExecutionInvocation(
extra_flags={
Expand All @@ -508,7 +508,7 @@ def testMakeProtoPlaceholder_MapFieldScalarValue(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_MapFieldScalarPlaceholderValue(self):
def test_MapFieldScalarPlaceholderValue(self):
actual = resolve(
_ExecutionInvocation(
extra_flags={
Expand All @@ -531,7 +531,7 @@ def testMakeProtoPlaceholder_MapFieldScalarPlaceholderValue(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_MapFieldScalarNoneValue(self):
def test_MapFieldScalarNoneValue(self):
actual = resolve(
_ExecutionInvocation(
extra_flags={
Expand All @@ -552,7 +552,7 @@ def testMakeProtoPlaceholder_MapFieldScalarNoneValue(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_MapFieldSubmessageValue(self):
def test_MapFieldSubmessageValue(self):
actual = resolve(
_ExecutionInvocation(
execution_properties={
Expand Down Expand Up @@ -581,7 +581,7 @@ def testMakeProtoPlaceholder_MapFieldSubmessageValue(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_MapFieldSubmessageNoneValue(self):
def test_MapFieldSubmessageNoneValue(self):
actual = resolve(
_ExecutionInvocation(
execution_properties={
Expand All @@ -603,7 +603,7 @@ def testMakeProtoPlaceholder_MapFieldSubmessageNoneValue(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_MapFieldPlaceholderKey(self):
def test_MapFieldPlaceholderKey(self):
actual = resolve(
_ExecutionInvocation(
extra_flags=[
Expand All @@ -621,7 +621,7 @@ def testMakeProtoPlaceholder_MapFieldPlaceholderKey(self):
parse_text_proto(actual),
)

def testMakeProtoPlaceholder_RejectsMapFieldScalarNoneKey(self):
def test_RejectsMapFieldScalarNoneKey(self):
with self.assertRaises(ValueError):
resolve(
_ExecutionInvocation(
Expand All @@ -635,13 +635,13 @@ def testMakeProtoPlaceholder_RejectsMapFieldScalarNoneKey(self):
with self.assertRaises(ValueError):
resolve(_ExecutionInvocation(extra_flags={None: 'foo'}))

def testMakeProtoPlaceholder_MapFieldScalarValueEmpty(self):
def test_MapFieldScalarValueEmpty(self):
actual = resolve(_ExecutionInvocation(extra_flags={}))
self.assertProtoEquals('', parse_text_proto(actual))
actual = resolve(_ExecutionInvocation(extra_flags=[]))
self.assertProtoEquals('', parse_text_proto(actual))

def testMakeProtoPlaceholder_PlusItemGetter(self):
def test_PlusItemGetter(self):
actual = resolve(
_ExecutionInvocation(
pipeline_node=ph.make_proto(
Expand All @@ -657,7 +657,7 @@ def testMakeProtoPlaceholder_PlusItemGetter(self):
)
self.assertProtoEquals('test-run-id-foo', actual)

def test_MakeProtoPlaceholder_BinarySerializationBase64(self):
def test_BinarySerializationBase64(self):
actual = resolve(
ph.make_proto(
execution_invocation_pb2.ExecutionInvocation(
Expand Down

0 comments on commit 59ae2c5

Please sign in to comment.