コード例 #1
0
    def test_return_none(self, fn, args):
        """Test that fn of Mixin returns None.

    Args:
      fn: fn of Mixin to test
      args: arguments to fn of Mixin
    """
        loss = StrongConvexMixin()
        ret = getattr(loss, fn, None)(*args)
        self.assertEqual(ret, None)
コード例 #2
0
    def test_not_implemented(self, fn, args):
        """Test that the given fn's are not implemented on the mixin.

    Args:
      fn: fn on Mixin to test
      args: arguments to fn of Mixin
    """
        with self.assertRaises(NotImplementedError):
            loss = StrongConvexMixin()
            getattr(loss, fn, None)(*args)