Esempio n. 1
0
    def test_cc_py_init_deprecated(self):
        mut_cc.ExampleCppClass()

        with catch_drake_warnings(expected_count=1) as w:
            mut_cc.ExampleCppClass(0)
            self.assertIn("Do not use ExampleCppClass(int)", str(w[0].message))
        with catch_drake_warnings(expected_count=1) as w:
            mut_cc.ExampleCppClass(0.0)
            self.assertIn("Do not use ExampleCppClass(double)",
                          str(w[0].message))
Esempio n. 2
0
    def test_cc_deprecate_attribute(self):
        obj = mut_cc.ExampleCppClass()

        with catch_drake_warnings(expected_count=2) as w:
            obj.DeprecatedMethod()
            self.assertIn("Do not use DeprecatedMethod", str(w[0].message))
            obj.DeprecatedMethod(int())
            self.assertEqual(str(w[0].message), str(w[1].message))
Esempio n. 3
0
    def test_cc_wrap_deprecated_for_overload(self):
        obj = mut_cc.ExampleCppClass()

        # Not deprecated.
        obj.overload()

        with catch_drake_warnings(expected_count=1) as w:
            obj.overload(0)
            self.assertIn("Do not use overload(int)", str(w[0].message))
Esempio n. 4
0
    def test_cc_wrap_deprecated_for_old_kwarg(self):
        obj = mut_cc.ExampleCppClass()

        # Not deprecated.
        obj.FunctionWithArgumentName(1)
        obj.FunctionWithArgumentName(new_name=1)

        with catch_drake_warnings(expected_count=1) as w:
            obj.FunctionWithArgumentName(old_name=1)
            self.assertIn("FunctionWithArgumentName(old_name)",
                          str(w[0].message))