MCPcopy Index your code
hub / github.com/pytorch/pytorch / testFromColumnList

Method testFromColumnList

caffe2/python/schema_test.py:415–430  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

413 self.assertEqual(rec, schema.Struct())
414
415 def testFromColumnList(self):
416 st = schema.Struct(
417 ('a', schema.Scalar()),
418 ('b', schema.List(schema.Scalar())),
419 ('c', schema.Map(schema.Scalar(), schema.Scalar()))
420 )
421 columns = st.field_names()
422 # test that recovery works for arbitrary order
423 for _ in range(10):
424 some_blobs = [core.BlobReference('blob:' + x) for x in columns]
425 rec = schema.from_column_list(columns, col_blobs=some_blobs)
426 self.assertTrue(rec.has_blobs())
427 self.assertEqual(sorted(st.field_names()), sorted(rec.field_names()))
428 self.assertEqual([str(blob) for blob in rec.field_blobs()],
429 [str('blob:' + name) for name in rec.field_names()])
430 random.shuffle(columns)
431
432 def testStructGet(self):
433 net = core.Net('test_net')

Callers

nothing calls this directly

Calls 7

field_namesMethod · 0.95
shuffleMethod · 0.80
rangeFunction · 0.50
has_blobsMethod · 0.45
assertEqualMethod · 0.45
field_namesMethod · 0.45
field_blobsMethod · 0.45

Tested by

no test coverage detected