How to use dict method in pytest-mock

Best Python code snippet using pytest-mock

test_nvlist.py

Source:test_nvlist.py Github

copy

Full Screen

...27 uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t,28 uint64_t, int64_t, boolean_t, uchar_t29)30class TestNVList(unittest.TestCase):31 def _dict_to_nvlist_to_dict(self, props):32 res = {}33 nv_in = nvlist_in(props)34 with nvlist_out(res) as nv_out:35 _lib.nvlist_dup(nv_in, nv_out, 0)36 return res37 def _assertIntDictsEqual(self, dict1, dict2):38 self.assertEqual(39 len(dict1), len(dict1),40 b"resulting dictionary is of different size")41 for key in dict1.keys():42 self.assertEqual(int(dict1[key]), int(dict2[key]))43 def _assertIntArrayDictsEqual(self, dict1, dict2):44 self.assertEqual(45 len(dict1), len(dict1),46 b"resulting dictionary is of different size")47 for key in dict1.keys():48 val1 = dict1[key]49 val2 = dict2[key]50 self.assertEqual(51 len(val1), len(val2), b"array values of different sizes")52 for x, y in zip(val1, val2):53 self.assertEqual(int(x), int(y))54 def test_empty(self):55 res = self._dict_to_nvlist_to_dict({})56 self.assertEqual(len(res), 0, b"expected empty dict")57 def test_invalid_key_type(self):58 with self.assertRaises(TypeError):59 self._dict_to_nvlist_to_dict({1: None})60 def test_invalid_val_type__tuple(self):61 with self.assertRaises(TypeError):62 self._dict_to_nvlist_to_dict({b"key": (1, 2)})63 def test_invalid_val_type__set(self):64 with self.assertRaises(TypeError):65 self._dict_to_nvlist_to_dict({b"key": set(1, 2)})66 def test_invalid_array_val_type(self):67 with self.assertRaises(TypeError):68 self._dict_to_nvlist_to_dict({b"key": [(1, 2), (3, 4)]})69 def test_invalid_array_of_arrays_val_type(self):70 with self.assertRaises(TypeError):71 self._dict_to_nvlist_to_dict({b"key": [[1, 2], [3, 4]]})72 def test_string_value(self):73 props = {b"key": b"value"}74 res = self._dict_to_nvlist_to_dict(props)75 self.assertEqual(props, res)76 def test_implicit_boolean_value(self):77 props = {b"key": None}78 res = self._dict_to_nvlist_to_dict(props)79 self.assertEqual(props, res)80 def test_boolean_values(self):81 props = {b"key1": True, b"key2": False}82 res = self._dict_to_nvlist_to_dict(props)83 self.assertEqual(props, res)84 def test_explicit_boolean_true_value(self):85 props = {b"key": boolean_t(1)}86 res = self._dict_to_nvlist_to_dict(props)87 self._assertIntDictsEqual(props, res)88 def test_explicit_boolean_false_value(self):89 props = {b"key": boolean_t(0)}90 res = self._dict_to_nvlist_to_dict(props)91 self._assertIntDictsEqual(props, res)92 def test_explicit_boolean_invalid_value(self):93 with self.assertRaises(OverflowError):94 props = {b"key": boolean_t(2)}95 self._dict_to_nvlist_to_dict(props)96 def test_explicit_boolean_another_invalid_value(self):97 with self.assertRaises(OverflowError):98 props = {b"key": boolean_t(-1)}99 self._dict_to_nvlist_to_dict(props)100 def test_uint64_value(self):101 props = {b"key": 1}102 res = self._dict_to_nvlist_to_dict(props)103 self.assertEqual(props, res)104 def test_uint64_max_value(self):105 props = {b"key": 2 ** 64 - 1}106 res = self._dict_to_nvlist_to_dict(props)107 self.assertEqual(props, res)108 def test_uint64_too_large_value(self):109 props = {b"key": 2 ** 64}110 with self.assertRaises(OverflowError):111 self._dict_to_nvlist_to_dict(props)112 def test_uint64_negative_value(self):113 props = {b"key": -1}114 with self.assertRaises(OverflowError):115 self._dict_to_nvlist_to_dict(props)116 def test_explicit_uint64_value(self):117 props = {b"key": uint64_t(1)}118 res = self._dict_to_nvlist_to_dict(props)119 self._assertIntDictsEqual(props, res)120 def test_explicit_uint64_max_value(self):121 props = {b"key": uint64_t(2 ** 64 - 1)}122 res = self._dict_to_nvlist_to_dict(props)123 self._assertIntDictsEqual(props, res)124 def test_explicit_uint64_too_large_value(self):125 with self.assertRaises(OverflowError):126 props = {b"key": uint64_t(2 ** 64)}127 self._dict_to_nvlist_to_dict(props)128 def test_explicit_uint64_negative_value(self):129 with self.assertRaises(OverflowError):130 props = {b"key": uint64_t(-1)}131 self._dict_to_nvlist_to_dict(props)132 def test_explicit_uint32_value(self):133 props = {b"key": uint32_t(1)}134 res = self._dict_to_nvlist_to_dict(props)135 self._assertIntDictsEqual(props, res)136 def test_explicit_uint32_max_value(self):137 props = {b"key": uint32_t(2 ** 32 - 1)}138 res = self._dict_to_nvlist_to_dict(props)139 self._assertIntDictsEqual(props, res)140 def test_explicit_uint32_too_large_value(self):141 with self.assertRaises(OverflowError):142 props = {b"key": uint32_t(2 ** 32)}143 self._dict_to_nvlist_to_dict(props)144 def test_explicit_uint32_negative_value(self):145 with self.assertRaises(OverflowError):146 props = {b"key": uint32_t(-1)}147 self._dict_to_nvlist_to_dict(props)148 def test_explicit_uint16_value(self):149 props = {b"key": uint16_t(1)}150 res = self._dict_to_nvlist_to_dict(props)151 self._assertIntDictsEqual(props, res)152 def test_explicit_uint16_max_value(self):153 props = {b"key": uint16_t(2 ** 16 - 1)}154 res = self._dict_to_nvlist_to_dict(props)155 self._assertIntDictsEqual(props, res)156 def test_explicit_uint16_too_large_value(self):157 with self.assertRaises(OverflowError):158 props = {b"key": uint16_t(2 ** 16)}159 self._dict_to_nvlist_to_dict(props)160 def test_explicit_uint16_negative_value(self):161 with self.assertRaises(OverflowError):162 props = {b"key": uint16_t(-1)}163 self._dict_to_nvlist_to_dict(props)164 def test_explicit_uint8_value(self):165 props = {b"key": uint8_t(1)}166 res = self._dict_to_nvlist_to_dict(props)167 self._assertIntDictsEqual(props, res)168 def test_explicit_uint8_max_value(self):169 props = {b"key": uint8_t(2 ** 8 - 1)}170 res = self._dict_to_nvlist_to_dict(props)171 self._assertIntDictsEqual(props, res)172 def test_explicit_uint8_too_large_value(self):173 with self.assertRaises(OverflowError):174 props = {b"key": uint8_t(2 ** 8)}175 self._dict_to_nvlist_to_dict(props)176 def test_explicit_uint8_negative_value(self):177 with self.assertRaises(OverflowError):178 props = {b"key": uint8_t(-1)}179 self._dict_to_nvlist_to_dict(props)180 def test_explicit_byte_value(self):181 props = {b"key": uchar_t(1)}182 res = self._dict_to_nvlist_to_dict(props)183 self._assertIntDictsEqual(props, res)184 def test_explicit_byte_max_value(self):185 props = {b"key": uchar_t(2 ** 8 - 1)}186 res = self._dict_to_nvlist_to_dict(props)187 self._assertIntDictsEqual(props, res)188 def test_explicit_byte_too_large_value(self):189 with self.assertRaises(OverflowError):190 props = {b"key": uchar_t(2 ** 8)}191 self._dict_to_nvlist_to_dict(props)192 def test_explicit_byte_negative_value(self):193 with self.assertRaises(OverflowError):194 props = {b"key": uchar_t(-1)}195 self._dict_to_nvlist_to_dict(props)196 def test_explicit_int64_value(self):197 props = {b"key": int64_t(1)}198 res = self._dict_to_nvlist_to_dict(props)199 self._assertIntDictsEqual(props, res)200 def test_explicit_int64_max_value(self):201 props = {b"key": int64_t(2 ** 63 - 1)}202 res = self._dict_to_nvlist_to_dict(props)203 self._assertIntDictsEqual(props, res)204 def test_explicit_int64_min_value(self):205 props = {b"key": int64_t(-(2 ** 63))}206 res = self._dict_to_nvlist_to_dict(props)207 self._assertIntDictsEqual(props, res)208 def test_explicit_int64_too_large_value(self):209 with self.assertRaises(OverflowError):210 props = {b"key": int64_t(2 ** 63)}211 self._dict_to_nvlist_to_dict(props)212 def test_explicit_int64_too_small_value(self):213 with self.assertRaises(OverflowError):214 props = {b"key": int64_t(-(2 ** 63) - 1)}215 self._dict_to_nvlist_to_dict(props)216 def test_explicit_int32_value(self):217 props = {b"key": int32_t(1)}218 res = self._dict_to_nvlist_to_dict(props)219 self._assertIntDictsEqual(props, res)220 def test_explicit_int32_max_value(self):221 props = {b"key": int32_t(2 ** 31 - 1)}222 res = self._dict_to_nvlist_to_dict(props)223 self._assertIntDictsEqual(props, res)224 def test_explicit_int32_min_value(self):225 props = {b"key": int32_t(-(2 ** 31))}226 res = self._dict_to_nvlist_to_dict(props)227 self._assertIntDictsEqual(props, res)228 def test_explicit_int32_too_large_value(self):229 with self.assertRaises(OverflowError):230 props = {b"key": int32_t(2 ** 31)}231 self._dict_to_nvlist_to_dict(props)232 def test_explicit_int32_too_small_value(self):233 with self.assertRaises(OverflowError):234 props = {b"key": int32_t(-(2 ** 31) - 1)}235 self._dict_to_nvlist_to_dict(props)236 def test_explicit_int16_value(self):237 props = {b"key": int16_t(1)}238 res = self._dict_to_nvlist_to_dict(props)239 self._assertIntDictsEqual(props, res)240 def test_explicit_int16_max_value(self):241 props = {b"key": int16_t(2 ** 15 - 1)}242 res = self._dict_to_nvlist_to_dict(props)243 self._assertIntDictsEqual(props, res)244 def test_explicit_int16_min_value(self):245 props = {b"key": int16_t(-(2 ** 15))}246 res = self._dict_to_nvlist_to_dict(props)247 self._assertIntDictsEqual(props, res)248 def test_explicit_int16_too_large_value(self):249 with self.assertRaises(OverflowError):250 props = {b"key": int16_t(2 ** 15)}251 self._dict_to_nvlist_to_dict(props)252 def test_explicit_int16_too_small_value(self):253 with self.assertRaises(OverflowError):254 props = {b"key": int16_t(-(2 ** 15) - 1)}255 self._dict_to_nvlist_to_dict(props)256 def test_explicit_int8_value(self):257 props = {b"key": int8_t(1)}258 res = self._dict_to_nvlist_to_dict(props)259 self._assertIntDictsEqual(props, res)260 def test_explicit_int8_max_value(self):261 props = {b"key": int8_t(2 ** 7 - 1)}262 res = self._dict_to_nvlist_to_dict(props)263 self._assertIntDictsEqual(props, res)264 def test_explicit_int8_min_value(self):265 props = {b"key": int8_t(-(2 ** 7))}266 res = self._dict_to_nvlist_to_dict(props)267 self._assertIntDictsEqual(props, res)268 def test_explicit_int8_too_large_value(self):269 with self.assertRaises(OverflowError):270 props = {b"key": int8_t(2 ** 7)}271 self._dict_to_nvlist_to_dict(props)272 def test_explicit_int8_too_small_value(self):273 with self.assertRaises(OverflowError):274 props = {b"key": int8_t(-(2 ** 7) - 1)}275 self._dict_to_nvlist_to_dict(props)276 def test_nested_dict(self):277 props = {b"key": {}}278 res = self._dict_to_nvlist_to_dict(props)279 self.assertEqual(props, res)280 def test_nested_nested_dict(self):281 props = {b"key": {b"key": {}}}282 res = self._dict_to_nvlist_to_dict(props)283 self.assertEqual(props, res)284 def test_mismatching_values_array(self):285 props = {b"key": [1, b"string"]}286 with self.assertRaises(TypeError):287 self._dict_to_nvlist_to_dict(props)288 def test_mismatching_values_array2(self):289 props = {b"key": [True, 10]}290 with self.assertRaises(TypeError):291 self._dict_to_nvlist_to_dict(props)292 def test_mismatching_values_array3(self):293 props = {b"key": [1, False]}294 with self.assertRaises(TypeError):295 self._dict_to_nvlist_to_dict(props)296 def test_string_array(self):297 props = {b"key": [b"value", b"value2"]}298 res = self._dict_to_nvlist_to_dict(props)299 self.assertEqual(props, res)300 def test_boolean_array(self):301 props = {b"key": [True, False]}302 res = self._dict_to_nvlist_to_dict(props)303 self.assertEqual(props, res)304 def test_explicit_boolean_array(self):305 props = {b"key": [boolean_t(False), boolean_t(True)]}306 res = self._dict_to_nvlist_to_dict(props)307 self._assertIntArrayDictsEqual(props, res)308 def test_uint64_array(self):309 props = {b"key": [0, 1, 2 ** 64 - 1]}310 res = self._dict_to_nvlist_to_dict(props)311 self.assertEqual(props, res)312 def test_uint64_array_too_large_value(self):313 props = {b"key": [0, 2 ** 64]}314 with self.assertRaises(OverflowError):315 self._dict_to_nvlist_to_dict(props)316 def test_uint64_array_negative_value(self):317 props = {b"key": [0, -1]}318 with self.assertRaises(OverflowError):319 self._dict_to_nvlist_to_dict(props)320 def test_mixed_explict_int_array(self):321 with self.assertRaises(TypeError):322 props = {b"key": [uint64_t(0), uint32_t(0)]}323 self._dict_to_nvlist_to_dict(props)324 def test_explict_uint64_array(self):325 props = {b"key": [uint64_t(0), uint64_t(1), uint64_t(2 ** 64 - 1)]}326 res = self._dict_to_nvlist_to_dict(props)327 self._assertIntArrayDictsEqual(props, res)328 def test_explict_uint64_array_too_large_value(self):329 with self.assertRaises(OverflowError):330 props = {b"key": [uint64_t(0), uint64_t(2 ** 64)]}331 self._dict_to_nvlist_to_dict(props)332 def test_explict_uint64_array_negative_value(self):333 with self.assertRaises(OverflowError):334 props = {b"key": [uint64_t(0), uint64_t(-1)]}335 self._dict_to_nvlist_to_dict(props)336 def test_explict_uint32_array(self):337 props = {b"key": [uint32_t(0), uint32_t(1), uint32_t(2 ** 32 - 1)]}338 res = self._dict_to_nvlist_to_dict(props)339 self._assertIntArrayDictsEqual(props, res)340 def test_explict_uint32_array_too_large_value(self):341 with self.assertRaises(OverflowError):342 props = {b"key": [uint32_t(0), uint32_t(2 ** 32)]}343 self._dict_to_nvlist_to_dict(props)344 def test_explict_uint32_array_negative_value(self):345 with self.assertRaises(OverflowError):346 props = {b"key": [uint32_t(0), uint32_t(-1)]}347 self._dict_to_nvlist_to_dict(props)348 def test_explict_uint16_array(self):349 props = {b"key": [uint16_t(0), uint16_t(1), uint16_t(2 ** 16 - 1)]}350 res = self._dict_to_nvlist_to_dict(props)351 self._assertIntArrayDictsEqual(props, res)352 def test_explict_uint16_array_too_large_value(self):353 with self.assertRaises(OverflowError):354 props = {b"key": [uint16_t(0), uint16_t(2 ** 16)]}355 self._dict_to_nvlist_to_dict(props)356 def test_explict_uint16_array_negative_value(self):357 with self.assertRaises(OverflowError):358 props = {b"key": [uint16_t(0), uint16_t(-1)]}359 self._dict_to_nvlist_to_dict(props)360 def test_explict_uint8_array(self):361 props = {b"key": [uint8_t(0), uint8_t(1), uint8_t(2 ** 8 - 1)]}362 res = self._dict_to_nvlist_to_dict(props)363 self._assertIntArrayDictsEqual(props, res)364 def test_explict_uint8_array_too_large_value(self):365 with self.assertRaises(OverflowError):366 props = {b"key": [uint8_t(0), uint8_t(2 ** 8)]}367 self._dict_to_nvlist_to_dict(props)368 def test_explict_uint8_array_negative_value(self):369 with self.assertRaises(OverflowError):370 props = {b"key": [uint8_t(0), uint8_t(-1)]}371 self._dict_to_nvlist_to_dict(props)372 def test_explict_byte_array(self):373 props = {b"key": [uchar_t(0), uchar_t(1), uchar_t(2 ** 8 - 1)]}374 res = self._dict_to_nvlist_to_dict(props)375 self._assertIntArrayDictsEqual(props, res)376 def test_explict_byte_array_too_large_value(self):377 with self.assertRaises(OverflowError):378 props = {b"key": [uchar_t(0), uchar_t(2 ** 8)]}379 self._dict_to_nvlist_to_dict(props)380 def test_explict_byte_array_negative_value(self):381 with self.assertRaises(OverflowError):382 props = {b"key": [uchar_t(0), uchar_t(-1)]}383 self._dict_to_nvlist_to_dict(props)384 def test_explict_int64_array(self):385 props = {b"key": [386 int64_t(0), int64_t(1), int64_t(2 ** 63 - 1), int64_t(-(2 ** 63))]}387 res = self._dict_to_nvlist_to_dict(props)388 self._assertIntArrayDictsEqual(props, res)389 def test_explict_int64_array_too_large_value(self):390 with self.assertRaises(OverflowError):391 props = {b"key": [int64_t(0), int64_t(2 ** 63)]}392 self._dict_to_nvlist_to_dict(props)393 def test_explict_int64_array_too_small_value(self):394 with self.assertRaises(OverflowError):395 props = {b"key": [int64_t(0), int64_t(-(2 ** 63) - 1)]}396 self._dict_to_nvlist_to_dict(props)397 def test_explict_int32_array(self):398 props = {b"key": [399 int32_t(0), int32_t(1), int32_t(2 ** 31 - 1), int32_t(-(2 ** 31))]}400 res = self._dict_to_nvlist_to_dict(props)401 self._assertIntArrayDictsEqual(props, res)402 def test_explict_int32_array_too_large_value(self):403 with self.assertRaises(OverflowError):404 props = {b"key": [int32_t(0), int32_t(2 ** 31)]}405 self._dict_to_nvlist_to_dict(props)406 def test_explict_int32_array_too_small_value(self):407 with self.assertRaises(OverflowError):408 props = {b"key": [int32_t(0), int32_t(-(2 ** 31) - 1)]}409 self._dict_to_nvlist_to_dict(props)410 def test_explict_int16_array(self):411 props = {b"key": [412 int16_t(0), int16_t(1), int16_t(2 ** 15 - 1), int16_t(-(2 ** 15))]}413 res = self._dict_to_nvlist_to_dict(props)414 self._assertIntArrayDictsEqual(props, res)415 def test_explict_int16_array_too_large_value(self):416 with self.assertRaises(OverflowError):417 props = {b"key": [int16_t(0), int16_t(2 ** 15)]}418 self._dict_to_nvlist_to_dict(props)419 def test_explict_int16_array_too_small_value(self):420 with self.assertRaises(OverflowError):421 props = {b"key": [int16_t(0), int16_t(-(2 ** 15) - 1)]}422 self._dict_to_nvlist_to_dict(props)423 def test_explict_int8_array(self):424 props = {b"key": [425 int8_t(0), int8_t(1), int8_t(2 ** 7 - 1), int8_t(-(2 ** 7))]}426 res = self._dict_to_nvlist_to_dict(props)427 self._assertIntArrayDictsEqual(props, res)428 def test_explict_int8_array_too_large_value(self):429 with self.assertRaises(OverflowError):430 props = {b"key": [int8_t(0), int8_t(2 ** 7)]}431 self._dict_to_nvlist_to_dict(props)432 def test_explict_int8_array_too_small_value(self):433 with self.assertRaises(OverflowError):434 props = {b"key": [int8_t(0), int8_t(-(2 ** 7) - 1)]}435 self._dict_to_nvlist_to_dict(props)436 def test_dict_array(self):437 props = {b"key": [{b"key": 1}, {b"key": None}, {b"key": {}}]}438 res = self._dict_to_nvlist_to_dict(props)439 self.assertEqual(props, res)440 def test_implicit_uint32_value(self):441 props = {b"rewind-request": 1}442 res = self._dict_to_nvlist_to_dict(props)443 self._assertIntDictsEqual(props, res)444 def test_implicit_uint32_max_value(self):445 props = {b"rewind-request": 2 ** 32 - 1}446 res = self._dict_to_nvlist_to_dict(props)447 self._assertIntDictsEqual(props, res)448 def test_implicit_uint32_too_large_value(self):449 with self.assertRaises(OverflowError):450 props = {b"rewind-request": 2 ** 32}451 self._dict_to_nvlist_to_dict(props)452 def test_implicit_uint32_negative_value(self):453 with self.assertRaises(OverflowError):454 props = {b"rewind-request": -1}455 self._dict_to_nvlist_to_dict(props)456 def test_implicit_int32_value(self):457 props = {b"pool_context": 1}458 res = self._dict_to_nvlist_to_dict(props)459 self._assertIntDictsEqual(props, res)460 def test_implicit_int32_max_value(self):461 props = {b"pool_context": 2 ** 31 - 1}462 res = self._dict_to_nvlist_to_dict(props)463 self._assertIntDictsEqual(props, res)464 def test_implicit_int32_min_value(self):465 props = {b"pool_context": -(2 ** 31)}466 res = self._dict_to_nvlist_to_dict(props)467 self._assertIntDictsEqual(props, res)468 def test_implicit_int32_too_large_value(self):469 with self.assertRaises(OverflowError):470 props = {b"pool_context": 2 ** 31}471 self._dict_to_nvlist_to_dict(props)472 def test_implicit_int32_too_small_value(self):473 with self.assertRaises(OverflowError):474 props = {b"pool_context": -(2 ** 31) - 1}475 self._dict_to_nvlist_to_dict(props)476 def test_complex_dict(self):477 props = {478 b"key1": b"str",479 b"key2": 10,480 b"key3": {481 b"skey1": True,482 b"skey2": None,483 b"skey3": [484 True,485 False,486 True487 ]488 },489 b"key4": [490 b"ab",491 b"bc"492 ],493 b"key5": [494 2 ** 64 - 1,495 1,496 2,497 3498 ],499 b"key6": [500 {501 b"skey71": b"a",502 b"skey72": b"b",503 },504 {505 b"skey71": b"c",506 b"skey72": b"d",507 },508 {509 b"skey71": b"e",510 b"skey72": b"f",511 }512 ],513 b"type": 2 ** 32 - 1,514 b"pool_context": -(2 ** 31)515 }516 res = self._dict_to_nvlist_to_dict(props)517 self.assertEqual(props, res)...

Full Screen

Full Screen

test_userdict.py

Source:test_userdict.py Github

copy

Full Screen

1# Check every path through every method of UserDict23from test import test_support, mapping_tests4import UserDict5import warnings67d0 = {}8d1 = {"one": 1}9d2 = {"one": 1, "two": 2}10d3 = {"one": 1, "two": 3, "three": 5}11d4 = {"one": None, "two": None}12d5 = {"one": 1, "two": 1}1314class UserDictTest(mapping_tests.TestHashMappingProtocol):15 type2test = UserDict.IterableUserDict1617 def test_all(self):18 # Test constructors19 u = UserDict.UserDict()20 u0 = UserDict.UserDict(d0)21 u1 = UserDict.UserDict(d1)22 u2 = UserDict.IterableUserDict(d2)2324 uu = UserDict.UserDict(u)25 uu0 = UserDict.UserDict(u0)26 uu1 = UserDict.UserDict(u1)27 uu2 = UserDict.UserDict(u2)2829 # keyword arg constructor30 self.assertEqual(UserDict.UserDict(one=1, two=2), d2)31 # item sequence constructor32 self.assertEqual(UserDict.UserDict([('one',1), ('two',2)]), d2)33 with test_support.check_warnings((".*'dict'.*",34 PendingDeprecationWarning)):35 self.assertEqual(UserDict.UserDict(dict=[('one',1), ('two',2)]), d2)36 # both together37 self.assertEqual(UserDict.UserDict([('one',1), ('two',2)], two=3, three=5), d3)3839 # alternate constructor40 self.assertEqual(UserDict.UserDict.fromkeys('one two'.split()), d4)41 self.assertEqual(UserDict.UserDict().fromkeys('one two'.split()), d4)42 self.assertEqual(UserDict.UserDict.fromkeys('one two'.split(), 1), d5)43 self.assertEqual(UserDict.UserDict().fromkeys('one two'.split(), 1), d5)44 self.assertTrue(u1.fromkeys('one two'.split()) is not u1)45 self.assertIsInstance(u1.fromkeys('one two'.split()), UserDict.UserDict)46 self.assertIsInstance(u2.fromkeys('one two'.split()), UserDict.IterableUserDict)4748 # Test __repr__49 self.assertEqual(str(u0), str(d0))50 self.assertEqual(repr(u1), repr(d1))51 self.assertEqual(repr(u2), repr(d2))5253 # Test __cmp__ and __len__54 all = [d0, d1, d2, u, u0, u1, u2, uu, uu0, uu1, uu2]55 for a in all:56 for b in all:57 self.assertEqual(cmp(a, b), cmp(len(a), len(b)))5859 # Test __getitem__60 self.assertEqual(u2["one"], 1)61 self.assertRaises(KeyError, u1.__getitem__, "two")6263 # Test __setitem__64 u3 = UserDict.UserDict(u2)65 u3["two"] = 266 u3["three"] = 36768 # Test __delitem__69 del u3["three"]70 self.assertRaises(KeyError, u3.__delitem__, "three")7172 # Test clear73 u3.clear()74 self.assertEqual(u3, {})7576 # Test copy()77 u2a = u2.copy()78 self.assertEqual(u2a, u2)79 u2b = UserDict.UserDict(x=42, y=23)80 u2c = u2b.copy() # making a copy of a UserDict is special cased81 self.assertEqual(u2b, u2c)8283 class MyUserDict(UserDict.UserDict):84 def display(self): print self8586 m2 = MyUserDict(u2)87 m2a = m2.copy()88 self.assertEqual(m2a, m2)8990 # SF bug #476616 -- copy() of UserDict subclass shared data91 m2['foo'] = 'bar'92 self.assertNotEqual(m2a, m2)9394 # Test keys, items, values95 self.assertEqual(u2.keys(), d2.keys())96 self.assertEqual(u2.items(), d2.items())97 self.assertEqual(u2.values(), d2.values())9899 # Test has_key and "in".100 for i in u2.keys():101 self.assertIn(i, u2)102 self.assertEqual(i in u1, i in d1)103 self.assertEqual(i in u0, i in d0)104 with test_support.check_py3k_warnings():105 self.assertTrue(u2.has_key(i))106 self.assertEqual(u1.has_key(i), d1.has_key(i))107 self.assertEqual(u0.has_key(i), d0.has_key(i))108109 # Test update110 t = UserDict.UserDict()111 t.update(u2)112 self.assertEqual(t, u2)113 class Items:114 def items(self):115 return (("x", 42), ("y", 23))116 t = UserDict.UserDict()117 t.update(Items())118 self.assertEqual(t, {"x": 42, "y": 23})119120 # Test get121 for i in u2.keys():122 self.assertEqual(u2.get(i), u2[i])123 self.assertEqual(u1.get(i), d1.get(i))124 self.assertEqual(u0.get(i), d0.get(i))125126 # Test "in" iteration.127 for i in xrange(20):128 u2[i] = str(i)129 ikeys = []130 for k in u2:131 ikeys.append(k)132 keys = u2.keys()133 self.assertEqual(set(ikeys), set(keys))134135 # Test setdefault136 t = UserDict.UserDict()137 self.assertEqual(t.setdefault("x", 42), 42)138 self.assertTrue(t.has_key("x"))139 self.assertEqual(t.setdefault("x", 23), 42)140141 # Test pop142 t = UserDict.UserDict(x=42)143 self.assertEqual(t.pop("x"), 42)144 self.assertRaises(KeyError, t.pop, "x")145 self.assertEqual(t.pop("x", 1), 1)146 t["x"] = 42147 self.assertEqual(t.pop("x", 1), 42)148149 # Test popitem150 t = UserDict.UserDict(x=42)151 self.assertEqual(t.popitem(), ("x", 42))152 self.assertRaises(KeyError, t.popitem)153154 def test_init(self):155 for kw in 'self', 'other', 'iterable':156 self.assertEqual(list(UserDict.UserDict(**{kw: 42}).items()),157 [(kw, 42)])158 self.assertEqual(list(UserDict.UserDict({}, dict=42).items()),159 [('dict', 42)])160 self.assertEqual(list(UserDict.UserDict({}, dict=None).items()),161 [('dict', None)])162 with test_support.check_warnings((".*'dict'.*",163 PendingDeprecationWarning)):164 self.assertEqual(list(UserDict.UserDict(dict={'a': 42}).items()),165 [('a', 42)])166 self.assertRaises(TypeError, UserDict.UserDict, 42)167 self.assertRaises(TypeError, UserDict.UserDict, (), ())168 self.assertRaises(TypeError, UserDict.UserDict.__init__)169170 def test_update(self):171 for kw in 'self', 'other', 'iterable':172 d = UserDict.UserDict()173 d.update(**{kw: 42})174 self.assertEqual(list(d.items()), [(kw, 42)])175 d = UserDict.UserDict()176 with test_support.check_warnings((".*'dict'.*",177 PendingDeprecationWarning)):178 d.update(dict={'a': 42})179 self.assertEqual(list(d.items()), [('a', 42)])180 self.assertRaises(TypeError, UserDict.UserDict().update, 42)181 self.assertRaises(TypeError, UserDict.UserDict().update, {}, {})182 self.assertRaises(TypeError, UserDict.UserDict.update)183184 def test_missing(self):185 # Make sure UserDict doesn't have a __missing__ method186 self.assertEqual(hasattr(UserDict, "__missing__"), False)187 # Test several cases:188 # (D) subclass defines __missing__ method returning a value189 # (E) subclass defines __missing__ method raising RuntimeError190 # (F) subclass sets __missing__ instance variable (no effect)191 # (G) subclass doesn't define __missing__ at all192 class D(UserDict.UserDict):193 def __missing__(self, key):194 return 42195 d = D({1: 2, 3: 4})196 self.assertEqual(d[1], 2)197 self.assertEqual(d[3], 4)198 self.assertNotIn(2, d)199 self.assertNotIn(2, d.keys())200 self.assertEqual(d[2], 42)201 class E(UserDict.UserDict):202 def __missing__(self, key):203 raise RuntimeError(key)204 e = E()205 try:206 e[42]207 except RuntimeError, err:208 self.assertEqual(err.args, (42,))209 else:210 self.fail("e[42] didn't raise RuntimeError")211 class F(UserDict.UserDict):212 def __init__(self):213 # An instance variable __missing__ should have no effect214 self.__missing__ = lambda key: None215 UserDict.UserDict.__init__(self)216 f = F()217 try:218 f[42]219 except KeyError, err:220 self.assertEqual(err.args, (42,))221 else:222 self.fail("f[42] didn't raise KeyError")223 class G(UserDict.UserDict):224 pass225 g = G()226 try:227 g[42]228 except KeyError, err:229 self.assertEqual(err.args, (42,))230 else:231 self.fail("g[42] didn't raise KeyError")232233##########################234# Test Dict Mixin235236class SeqDict(UserDict.DictMixin):237 """Dictionary lookalike implemented with lists.238239 Used to test and demonstrate DictMixin240 """241 def __init__(self, other=None, **kwargs):242 self.keylist = []243 self.valuelist = []244 if other is not None:245 for (key, value) in other:246 self[key] = value247 for (key, value) in kwargs.iteritems():248 self[key] = value249 def __getitem__(self, key):250 try:251 i = self.keylist.index(key)252 except ValueError:253 raise KeyError254 return self.valuelist[i]255 def __setitem__(self, key, value):256 try:257 i = self.keylist.index(key)258 self.valuelist[i] = value259 except ValueError:260 self.keylist.append(key)261 self.valuelist.append(value)262 def __delitem__(self, key):263 try:264 i = self.keylist.index(key)265 except ValueError:266 raise KeyError267 self.keylist.pop(i)268 self.valuelist.pop(i)269 def keys(self):270 return list(self.keylist)271 def copy(self):272 d = self.__class__()273 for key, value in self.iteritems():274 d[key] = value275 return d276 @classmethod277 def fromkeys(cls, keys, value=None):278 d = cls()279 for key in keys:280 d[key] = value281 return d282283class UserDictMixinTest(mapping_tests.TestMappingProtocol):284 type2test = SeqDict285286 def test_all(self):287 ## Setup test and verify working of the test class288289 # check init290 s = SeqDict()291292 # exercise setitem293 s[10] = 'ten'294 s[20] = 'twenty'295 s[30] = 'thirty'296297 # exercise delitem298 del s[20]299 # check getitem and setitem300 self.assertEqual(s[10], 'ten')301 # check keys() and delitem302 self.assertEqual(s.keys(), [10, 30])303304 ## Now, test the DictMixin methods one by one305 # has_key306 self.assertTrue(s.has_key(10))307 self.assertTrue(not s.has_key(20))308309 # __contains__310 self.assertIn(10, s)311 self.assertNotIn(20, s)312313 # __iter__314 self.assertEqual([k for k in s], [10, 30])315316 # __len__317 self.assertEqual(len(s), 2)318319 # iteritems320 self.assertEqual(list(s.iteritems()), [(10,'ten'), (30, 'thirty')])321322 # iterkeys323 self.assertEqual(list(s.iterkeys()), [10, 30])324325 # itervalues326 self.assertEqual(list(s.itervalues()), ['ten', 'thirty'])327328 # values329 self.assertEqual(s.values(), ['ten', 'thirty'])330331 # items332 self.assertEqual(s.items(), [(10,'ten'), (30, 'thirty')])333334 # get335 self.assertEqual(s.get(10), 'ten')336 self.assertEqual(s.get(15,'fifteen'), 'fifteen')337 self.assertEqual(s.get(15), None)338339 # setdefault340 self.assertEqual(s.setdefault(40, 'forty'), 'forty')341 self.assertEqual(s.setdefault(10, 'null'), 'ten')342 del s[40]343344 # pop345 self.assertEqual(s.pop(10), 'ten')346 self.assertNotIn(10, s)347 s[10] = 'ten'348 self.assertEqual(s.pop("x", 1), 1)349 s["x"] = 42350 self.assertEqual(s.pop("x", 1), 42)351352 # popitem353 k, v = s.popitem()354 self.assertNotIn(k, s)355 s[k] = v356357 # clear358 s.clear()359 self.assertEqual(len(s), 0)360361 # empty popitem362 self.assertRaises(KeyError, s.popitem)363364 # update365 s.update({10: 'ten', 20:'twenty'})366 self.assertEqual(s[10], 'ten')367 self.assertEqual(s[20], 'twenty')368369 # cmp370 self.assertEqual(s, {10: 'ten', 20:'twenty'})371 t = SeqDict()372 t[20] = 'twenty'373 t[10] = 'ten'374 self.assertEqual(s, t)375376def test_main():377 test_support.run_unittest(378 UserDictTest,379 UserDictMixinTest380 )381382if __name__ == "__main__": ...

Full Screen

Full Screen

type-factory.service.ts

Source:type-factory.service.ts Github

copy

Full Screen

1import {OperatorType, OperatorTypeDict} from '../operator-type.model';2// import {NumericAttributeFilterType, NumericAttributeFilterTypeDict} from './numeric-attribute-filter-type.model';3// import {RasterValueExtractionType, RasterValueExtractionTypeDict} from './raster-value-extraction-type.model';4import {ExpressionType, ExpressionTypeDict} from './expression-type.model';5// import {ProjectionType, ProjectionTypeDict} from './projection-type.model';6// import {GFBioSourceType, GFBioSourceTypeDict} from './gfbio-source-type.model';7// import {RasterSourceType, RasterSourceTypeDict} from './raster-source-type.model';8// import {HistogramType, HistogramTypeDict} from './histogram-type.model';9// import {RScriptType, RScriptTypeDict} from './r-script-type.model';10// import {PointInPolygonFilterType, PointInPolygonFilterTypeDict} from './point-in-polygon-filter-type.model';11// import {WKTSourceType, WKTSourceTypeDict} from './wkt-source-type.model';12// import {13// MsgCo2CorrectionType,14// MsgPansharpenType,15// MsgPansharpenTypeDict,16// MsgRadianceType,17// MsgReflectanceType,18// MsgReflectanceTypeDict,19// MsgSofosGccThermalThresholdType,20// MsgSolarangleType,21// MsgSolarangleTypeDict,22// MsgTemperatureType,23// } from './msg-types.model';24// import {CsvSourceType, CsvSourceTypeDict} from './csv-source-type.model';25// import {ClassificationType, ClassificationTypeDict} from './classification-type.model';26// import {27// FeatureCollectionDBSourceType,28// FeatureCollectionDBSourceTypeDict29// } from './feature-collection-db-source-type.model';30// import {TextualAttributeFilterType, TextualAttributeFilterTypeDict} from './textual-attribute-filter-type.model';31// import {GdalSourceType, GdalSourceTypeDict} from './gdal-source-type.model';32// import {ScatterPlotType, ScatterPlotTypeDict} from './scatterplot-type.model';33// import {BoxPlotType, BoxPlotTypeDict} from './boxplot-type.model';34// import {PieChartType, PieChartTypeDict} from './piechart-type.model';35// import {RasterizePolygonType, RasterizePolygonTypeDict} from './rasterize-polygon-type.model';36// import {HeatmapType, HeatmapTypeDict} from './heatmap-type.model';37// import {OgrSourceType, OgrSourceTypeDict} from './ogr-source-type.model';38// import {OgrRawSourceType, OgrRawSourceTypeDict} from './ogr-raw-source-type.model';39// import {ChronicleDBSourceType, ChronicleDBSourceTypeDict} from './chronicle-db-source-type.model';40// import {TimePlotType, TimePlotTypeDict} from './timeplot-type.model';41// import {StatisticsType, StatisticsTypeDict} from './statistics-type.model';42// import {RgbaCompositeType, RgbaCompositeTypeDict} from './rgba-composite-type.model';43type Type = string;44type Deserializer = (dict: OperatorTypeDict) => OperatorType;45/**46 * A simple factory for de-serializing operator types.47 */48export class OperatorTypeFactory {49 protected static readonly typeDeserializers: Map<Type, Deserializer> = OperatorTypeFactory.defaultDeserializers();50 /**51 * Add a new type deserializer (fromDict) to the factory52 */53 static addType(type: Type, fromDict: Deserializer): void {54 OperatorTypeFactory.typeDeserializers.set(type, fromDict);55 }56 /**57 * Create operator type from serialized data.58 */59 static fromDict(dict: OperatorTypeDict): OperatorType {60 const fromDict = OperatorTypeFactory.typeDeserializers.get(dict.operatorType);61 if (fromDict) {62 return fromDict(dict);63 } else {64 throw Error(`There is not factory method defined for operator »${dict.operatorType}«.`);65 }66 }67 protected static defaultDeserializers(): Map<Type, Deserializer> {68 const typeDeserializers = new Map();69 // typeDeserializers.set(70 // NumericAttributeFilterType.TYPE,71 // dict => NumericAttributeFilterType.fromDict(dict as NumericAttributeFilterTypeDict),72 // );73 // typeDeserializers.set(74 // TextualAttributeFilterType.TYPE,75 // dict => TextualAttributeFilterType.fromDict(dict as TextualAttributeFilterTypeDict),76 // );77 // typeDeserializers.set(78 // RasterValueExtractionType.TYPE,79 // dict => RasterValueExtractionType.fromDict(dict as RasterValueExtractionTypeDict),80 // );81 typeDeserializers.set(ExpressionType.TYPE, (dict) => ExpressionType.fromDict(dict as ExpressionTypeDict));82 // typeDeserializers.set(83 // ProjectionType.TYPE,84 // dict => ProjectionType.fromDict(dict as ProjectionTypeDict),85 // );86 // typeDeserializers.set(87 // GFBioSourceType.TYPE,88 // dict => GFBioSourceType.fromDict(dict as GFBioSourceTypeDict),89 // );90 // typeDeserializers.set(91 // RasterSourceType.TYPE,92 // dict => RasterSourceType.fromDict(dict as RasterSourceTypeDict),93 // );94 // typeDeserializers.set(95 // GdalSourceType.TYPE,96 // dict => GdalSourceType.fromDict(dict as GdalSourceTypeDict),97 // );98 // typeDeserializers.set(99 // OgrSourceType.TYPE,100 // dict => OgrSourceType.fromDict(dict as OgrSourceTypeDict),101 // );102 // typeDeserializers.set(103 // HistogramType.TYPE,104 // dict => HistogramType.fromDict(dict as HistogramTypeDict),105 // );106 // typeDeserializers.set(107 // RScriptType.TYPE,108 // dict => RScriptType.fromDict(dict as RScriptTypeDict),109 // );110 // typeDeserializers.set(111 // PointInPolygonFilterType.TYPE,112 // dict => PointInPolygonFilterType.fromDict(dict as PointInPolygonFilterTypeDict),113 // );114 // typeDeserializers.set(115 // WKTSourceType.TYPE,116 // dict => WKTSourceType.fromDict(dict as WKTSourceTypeDict),117 // );118 // typeDeserializers.set(119 // MsgRadianceType.TYPE,120 // dict => MsgRadianceType.fromDict(dict),121 // );122 // typeDeserializers.set(123 // MsgReflectanceType.TYPE,124 // dict => MsgReflectanceType.fromDict(dict as MsgReflectanceTypeDict),125 // );126 // typeDeserializers.set(127 // MsgSolarangleType.TYPE,128 // dict => MsgSolarangleType.fromDict(dict as MsgSolarangleTypeDict),129 // );130 // typeDeserializers.set(131 // MsgTemperatureType.TYPE,132 // dict => MsgTemperatureType.fromDict(dict),133 // );134 // typeDeserializers.set(135 // MsgPansharpenType.TYPE,136 // dict => MsgPansharpenType.fromDict(dict as MsgPansharpenTypeDict),137 // );138 // typeDeserializers.set(139 // MsgCo2CorrectionType.TYPE,140 // dict => MsgCo2CorrectionType.fromDict(dict),141 // );142 // typeDeserializers.set(143 // MsgSofosGccThermalThresholdType.TYPE,144 // dict => MsgSofosGccThermalThresholdType.fromDict(dict),145 // );146 // typeDeserializers.set(147 // CsvSourceType.TYPE,148 // dict => CsvSourceType.fromDict(dict as CsvSourceTypeDict),149 // );150 // typeDeserializers.set(151 // ClassificationType.TYPE,152 // dict => ClassificationType.fromDict(dict as ClassificationTypeDict),153 // );154 // typeDeserializers.set(155 // FeatureCollectionDBSourceType.TYPE,156 // dict => FeatureCollectionDBSourceType.fromDict(dict as FeatureCollectionDBSourceTypeDict),157 // );158 // typeDeserializers.set(159 // ScatterPlotType.TYPE,160 // dict => ScatterPlotType.fromDict(dict as ScatterPlotTypeDict),161 // );162 // typeDeserializers.set(163 // BoxPlotType.TYPE,164 // dict => BoxPlotType.fromDict(dict as BoxPlotTypeDict),165 // );166 // typeDeserializers.set(167 // PieChartType.TYPE,168 // dict => PieChartType.fromDict(dict as PieChartTypeDict),169 // );170 // typeDeserializers.set(171 // RasterizePolygonType.TYPE,172 // dict => RasterizePolygonType.fromDict(dict as RasterizePolygonTypeDict),173 // );174 // typeDeserializers.set(175 // HeatmapType.TYPE,176 // dict => HeatmapType.fromDict(dict as HeatmapTypeDict),177 // );178 // typeDeserializers.set(179 // StatisticsType.TYPE,180 // dict => StatisticsType.fromDict(dict as StatisticsTypeDict),181 // );182 // typeDeserializers.set(183 // TimePlotType.TYPE,184 // dict => TimePlotType.fromDict(dict as TimePlotTypeDict),185 // );186 // typeDeserializers.set(187 // RgbaCompositeType.TYPE,188 // dict => RgbaCompositeType.fromDict(dict as RgbaCompositeTypeDict),189 // );190 // typeDeserializers.set(191 // ChronicleDBSourceType.TYPE,192 // dict => ChronicleDBSourceType.fromDict(dict as ChronicleDBSourceTypeDict),193 // );194 // typeDeserializers.set(195 // OgrRawSourceType.TYPE,196 // dict => OgrRawSourceType.fromDict(dict as OgrRawSourceTypeDict),197 // );198 return typeDeserializers;199 }...

Full Screen

Full Screen

backend.model.ts

Source:backend.model.ts Github

copy

Full Screen

1export type UUID = string;2export type TimestampString = string;3export type SrsString = string;4export interface RegistrationDict {5 id: UUID;6}7export interface SessionDict {8 id: UUID;9 user: UserDict;10 created: TimestampString;11 valid_until: TimestampString;12 project?: UUID;13 view?: STRectangleDict;14}15export interface UserDict {16 id: UUID;17 email?: string;18 real_name?: string;19}20export interface CoordinateDict {21 x: number;22 y: number;23}24export interface BBoxDict {25 lower_left_coordinate: CoordinateDict;26 upper_right_coordinate: CoordinateDict;27}28/**29 * UNIX time in Milliseconds30 */31export interface TimeIntervalDict {32 start: number;33 end: number;34}35export interface STRectangleDict {36 spatial_reference: SrsString;37 bounding_box: BBoxDict;38 time_interval: TimeIntervalDict;39}40export interface CreateProjectResponseDict {41 id: UUID;42}43export interface ProjectListingDict {44 id: UUID;45 name: string;46 description: string;47 layer_names: Array<string>;48 changed: TimestampString;49}50export type ProjectPermissionDict = 'Read' | 'Write' | 'Owner';51export type ProjectFilterDict = 'None' | {name: {term: string}} | {description: {term: string}};52export type ProjectOrderByDict = 'DateAsc' | 'DateDesc' | 'NameAsc' | 'NameDesc';53export interface ProjectDict {54 id: UUID;55 version: ProjectVersion;56 name: string;57 description: string;58 layers: Array<LayerDict>;59 plots: Array<PlotDict>;60 bounds: STRectangleDict;61 time_step: TimeStepDict;62}63export interface LayerDict {64 workflow: UUID;65 name: string;66 visibility: {67 data: boolean;68 legend: boolean;69 };70 symbology: SymbologyDict;71}72export interface PlotDict {73 workflow: UUID;74 name: string;75}76export interface ProjectVersion {77 id: UUID;78 changed: TimestampString;79 author: UUID;80}81export interface LinearGradientDict {82 breakpoints: Array<BreakpointDict>;83 no_data_color: RgbaColorDict;84 default_color: RgbaColorDict;85}86export interface LogarithmitGradientDict {87 breakpoints: Array<BreakpointDict>;88 no_data_color: RgbaColorDict;89 default_color: RgbaColorDict;90}91export interface PaletteDict {92 colors: {93 [numberValue: string]: RgbaColorDict;94 };95 no_data_color: RgbaColorDict;96 default_color: RgbaColorDict;97}98export interface ColorizerDict {99 LinearGradient?: LinearGradientDict;100 LogarithmicGradient?: LogarithmitGradientDict;101 Palette?: PaletteDict;102 Rgba?: {[index: string]: never};103}104export type RgbaColorDict = [number, number, number, number];105export interface SymbologyDict {106 Raster?: RasterSymbologyDict;107 Vector?: VectorSymbologyDict;108}109export interface RasterSymbologyDict {110 opacity: number;111 colorizer: ColorizerDict;112}113export interface VectorSymbologyDict {114 Point?: PointSymbologyDict;115 Line?: LineSymbologyDict;116 Polygon?: PolygonSymbologyDict;117}118export interface TextSymbologyDict {119 attribute: string;120 fill_color: ColorParamDict;121 stroke: StrokeParamDict;122}123export interface PointSymbologyDict {124 radius: NumberParamDict;125 fill_color: ColorParamDict;126 stroke: StrokeParamDict;127 text?: TextSymbologyDict;128}129export interface LineSymbologyDict {130 stroke: StrokeParamDict;131 text?: TextSymbologyDict;132}133export interface PolygonSymbologyDict {134 fill_color: ColorParamDict;135 stroke: StrokeParamDict;136 text?: TextSymbologyDict;137}138export interface NumberParamDict {139 Static?: number;140 Derived?: DerivedNumberDict;141}142export interface ColorParamDict {143 Static?: RgbaColorDict;144 Derived?: DerivedColorDict;145}146export interface DerivedNumberDict {147 attribute: string;148 factor: number;149 default_value: number;150}151export interface DerivedColorDict {152 attribute: string;153 colorizer: ColorizerDict;154}155export interface StrokeParamDict {156 width: NumberParamDict;157 color: ColorParamDict;158 // TODO: dash159}160export interface BreakpointDict {161 value: number;162 color: RgbaColorDict;163}164export interface ErrorDict {165 error: string;166 message: string;167}168export interface ToDict<T> {169 toDict(): T;170}171export interface RegisterWorkflowResultDict {172 id: UUID;173}174export interface WorkflowDict {175 type: 'Vector' | 'Raster' | 'Plot';176 operator: OperatorDict | SourceOperatorDict;177}178export interface OperatorDict {179 type: string;180 params: OperatorParams;181 vector_sources?: Array<OperatorDict | SourceOperatorDict>;182 raster_sources?: Array<OperatorDict | SourceOperatorDict>;183}184type ParamTypes = string | number | boolean | Array<ParamTypes> | {[key: string]: ParamTypes};185export interface OperatorParams {186 [key: string]: ParamTypes;187}188export interface SourceOperatorDict {189 type: string;190 params: {191 data_set: InternalDataSetIdDict; // TODO: support all Id types192 };193}194export interface TimeStepDict {195 step: number;196 granularity: TimeStepGranularityDict;197}198export type TimeStepGranularityDict = 'Millis' | 'Seconds' | 'Minutes' | 'Hours' | 'Days' | 'Months' | 'Years';199export interface DataSetDict {200 id: InternalDataSetIdDict; // TODO: support all Id types201 name: string;202 description: string;203 result_descriptor: DatasetResultDescriptorDict;204 source_operator: string;205}206export interface InternalDataSetIdDict {207 Internal: UUID;208}209export interface DatasetResultDescriptorDict {210 Vector?: VectorResultDescriptorDict;211 Raster?: RasterResultDescriptorDict;212}213export interface NoDataDict {214 [key: string]: number;215}216export interface PlotDataDict {217 plot_type: string;218 output_format: 'JsonPlain' | 'JsonVega' | 'ImagePng';219 data: any;220}221export interface ResultDescriptorDict {222 spatial_reference?: SrsString;223}224export interface RasterResultDescriptorDict extends ResultDescriptorDict {225 data_type: 'U8' | 'U16' | 'U32' | 'U64' | 'I8' | 'I16' | 'I32' | 'I64' | 'F32' | 'F64';226 measurement: 'unitless' | MeasurementDict;227}228export interface VectorResultDescriptorDict extends ResultDescriptorDict {229 data_type: 'Data' | 'MultiPoint' | 'MultiLineString' | 'MultiPolygon';230 columns: {[key: string]: 'Categorical' | 'Decimal' | 'Number' | 'Text'};231}232export interface PlotResultDescriptorDict extends ResultDescriptorDict {233 spatial_reference: undefined;234}235export interface MeasurementDict {236 continuous?: {237 measurement: string;238 unit?: string;239 };240 classification?: {241 measurement: string;242 classes: {243 [key: number]: string;244 };245 };...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pytest-mock automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful