Esempio n. 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))
Esempio n. 2
0
 def to_map(in_: TeaModel, ) -> Dict[str, Any]:
     """
     Model transforms to map[string]any
     @return: map[string]any
     """
     if isinstance(in_, TeaModel):
         return in_.to_map()
     else:
         return in_