MCPcopy Create free account
hub / github.com/pytorch/pytorch / testPreservesEmptyFields

Method testPreservesEmptyFields

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

Source from the content-addressed store, hash-verified

233 s.a = schema.Scalar()
234
235 def testPreservesEmptyFields(self):
236 s = schema.Struct(
237 ('a', schema.Scalar(np.float32)),
238 ('b', schema.Struct()),
239 )
240 sc = s.clone()
241 self.assertIn("a", sc.fields)
242 self.assertIn("b", sc.fields)
243 sv = schema.from_blob_list(s, [np.array([3.4])])
244 self.assertIn("a", sv.fields)
245 self.assertIn("b", sv.fields)
246 self.assertEqual(0, len(sv.b.fields))
247
248 def testStructSubstraction(self):
249 s1 = schema.Struct(

Callers

nothing calls this directly

Calls 2

cloneMethod · 0.95
assertEqualMethod · 0.45

Tested by

no test coverage detected