예제 #1
0
    def test_validate_required(self):
        tm = TeaModel()
        tm.validate()
        tm.to_map()
        tm.from_map()

        n = tm.validate_required('test', 'prop_name')
        self.assertIsNone(n)

        try:
            tm.validate_required(None, 'prop_name')
            assert False
        except Exception as e:
            self.assertEqual('"prop_name" is required.', str(e))
예제 #2
0
 def test_validate_required(self):
     tm = TeaModel()
     n = tm.validate_required('test', 'prop_name')
     self.assertIsNone(n)
     self.assertRaises(Exception,
                       tm.validate_required,
                       prop=None,
                       prop_name='None')