From 13e8b6f0fbea89c0269808965de5f75753293dd6 Mon Sep 17 00:00:00 2001 From: Justin Chu Date: Tue, 17 Oct 2023 19:18:03 +0000 Subject: [PATCH] update test Signed-off-by: Justin Chu --- .../automatic_upgrade_test.py | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/onnx/test/version_converter/automatic_upgrade_test.py b/onnx/test/version_converter/automatic_upgrade_test.py index 76e45fc962a..552cc719463 100644 --- a/onnx/test/version_converter/automatic_upgrade_test.py +++ b/onnx/test/version_converter/automatic_upgrade_test.py @@ -16,7 +16,12 @@ class TestAutomaticUpgrade(automatic_conversion_test_base.TestAutomaticConversion): + @classmethod + def setUpClass(cls): + self.tested_ops = [] + def _test_op_upgrade(self, op, *args, **kwargs): + self.tested_ops.append(op) self._test_op_conversion(op, *args, **kwargs, is_upgrade=True) def test_Abs(self) -> None: @@ -1735,6 +1740,32 @@ def test_RegexFullMatch(self) -> None: [TensorProto.BOOL], ) + def test_ops_tested(self) -> None: + # NOTE: This test is order dependent and needs to run last in this class + all_schemas = onnx.defs.get_all_schemas() + all_op_names = {schema.name for schema in all_schemas if schema.domain == ""} + excluded_ops = { + # Sequence-based and Optional-based ops disabled because + # the version converter doesn't play nicely with sequences + "ConcatFromSequence", + "SequenceAt", + "SequenceConstruct", + "SequenceEmpty", + "SequenceErase", + "SequenceInsert", + "SequenceLength", + "SequenceMap", + "SplitToSequence", + "Optional", + "OptionalGetElement", + "OptionalHasElement", + "StringSplit", + } + expected_tested_ops = all_op_names - excluded_ops + + untested_ops = expected_tested_ops - set(tested_ops) + self.assertEqual(untested_ops, {}) + if __name__ == "__main__": unittest.main()