本文整理汇总了Python中common.TestCase类的典型用法代码示例。如果您正苦于以下问题:Python TestCase类的具体用法?Python TestCase怎么用?Python TestCase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestCase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
TestCase.setUp(self)
self.pipeline = gst.Pipeline()
self.src = gst.element_factory_make('fakesrc')
self.src.set_property('num-buffers', 10)
self.pipeline.add(self.src)
self.srcpad = self.src.get_pad('src')
示例2: tearDown
def tearDown(self):
# FIXME: wait for state change thread to settle down
while self.bin.__gstrefcount__ > 1:
time.sleep(0.1)
self.assertEquals(self.bin.__gstrefcount__, 1)
del self.bin
TestCase.tearDown(self)
示例3: setUp
def setUp(self):
TestCase.setUp(self)
filename = self.getFileName("dataset_test2dzerofloat")
print("filename:", filename)
self.f = h5py.File(filename, "w")
self.data = np.ones((0, 3), dtype="f")
self.dset = self.f.create_dataset("x", data=self.data)
示例4: setUp
def setUp(self):
TestCase.setUp(self)
self.factory = StubFactory()
self.stream = VideoStream(gst.Caps('video/x-raw-rgb'))
self.factory.addOutputStream(self.stream)
self.track1 = Track(self.stream)
self.track2 = Track(self.stream)
示例5: tearDown
def tearDown(self):
self.pipeline.setState(STATE_NULL)
self.pipeline.release()
self.monitor.disconnectFromObj(self.pipeline)
del self.pipeline
del self.monitor
TestCase.tearDown(self)
示例6: setUp
def setUp(self):
TestCase.setUp(self)
amix = find_mixer_element()
if amix:
self.mixer = amix.create()
else:
self.mixer = None
示例7: setUp
def setUp(self):
TestCase.setUp(self)
self.pipeline = gst.Pipeline()
self.assertEquals(self.pipeline.__gstrefcount__, 1)
self.assertEquals(sys.getrefcount(self.pipeline), pygobject_2_13 and 2 or 3)
self.fakesrc = gst.element_factory_make('fakesrc')
self.fakesink = gst.element_factory_make('fakesink')
self.assertEquals(self.fakesrc.__gstrefcount__, 1)
self.assertEquals(sys.getrefcount(self.fakesrc), pygobject_2_13 and 2 or 3)
self.pipeline.add(self.fakesrc, self.fakesink)
self.assertEquals(self.fakesrc.__gstrefcount__, 2) # added
self.assertEquals(sys.getrefcount(self.fakesrc), pygobject_2_13 and 2 or 3)
self.assertEquals(self.fakesink.__gstrefcount__, 2) # added
self.assertEquals(sys.getrefcount(self.fakesink), pygobject_2_13 and 2 or 3)
self.fakesrc.link(self.fakesink)
self.assertEquals(self.pipeline.__gstrefcount__, 1)
self.assertEquals(sys.getrefcount(self.pipeline), pygobject_2_13 and 2 or 3)
self.assertEquals(self.fakesrc.__gstrefcount__, 2)
self.assertEquals(sys.getrefcount(self.fakesrc), pygobject_2_13 and 2 or 3)
self.assertEquals(self.fakesink.__gstrefcount__, 2)
self.assertEquals(sys.getrefcount(self.fakesink), pygobject_2_13 and 2 or 3)
示例8: setUp
def setUp(self):
self.registry = gst.registry_get_default()
self.plugins = self.registry.get_plugin_list()
self.efeatures = self.registry.get_feature_list(gst.TYPE_ELEMENT_FACTORY)
self.tfeatures = self.registry.get_feature_list(gst.TYPE_TYPE_FIND_FACTORY)
self.ifeatures = self.registry.get_feature_list(gst.TYPE_INDEX_FACTORY)
TestCase.setUp(self)
示例9: setUp
def setUp(self):
TestCase.setUp(self)
filename = "dataset_testscalararray." + self.base_domain
self.f = h5py.File(filename, 'w')
self.dt = np.dtype('(3,2)f')
self.data = np.array([(3.2, -119), (42, 99.8), (3.14, 0)], dtype='f')
self.dset = self.f.create_dataset('x', (), dtype=self.dt)
self.dset[...] = self.data
示例10: tearDown
def tearDown(self):
self.assertEquals(sys.getrefcount(self.src), pygobject_2_13 and 2 or 3)
self.assertEquals(self.src.__gstrefcount__, 1)
del self.src
self.assertEquals(sys.getrefcount(self.sink), pygobject_2_13 and 2 or 3)
self.assertEquals(self.sink.__gstrefcount__, 1)
del self.sink
TestCase.tearDown(self)
示例11: tearDown
def tearDown(self):
self.discoverer.disconnect_by_function(self.discoveryErrorCb)
self.discoverer.disconnect_by_function(self.discoveryDoneCb)
self.discoverer = None
self.factories = None
self.error = None
self.src = None
TestCase.tearDown(self)
示例12: setUp
def setUp(self):
TestCase.setUp(self)
gst.debug("start")
self.pipeline = Pipeline()
self.monitor = SignalMonitor(self.pipeline, 'action-added',
'action-removed', 'factory-added',
'factory-removed', 'state-changed')
self.assertEquals(self.monitor.action_added_count, 0)
self.assertEquals(self.monitor.action_added_collect, [])
示例13: setUp
def setUp(self):
TestCase.setUp(self)
self.pipeline = gst.parse_launch('fakesrc name=source ! fakesink')
self.assertEquals(self.pipeline.__gstrefcount__, 1)
self.element = self.pipeline.get_by_name('source')
self.assertEquals(self.pipeline.__gstrefcount__, 1)
self.assertEquals(self.element.__gstrefcount__, 2)
self.assertEquals(sys.getrefcount(self.element), pygobject_2_13 and 2 or 3)
示例14: setUp
def setUp(self):
TestCase.setUp(self)
self.caps = gst.caps_from_string('video/x-raw-yuv,width=10,framerate=5/1;video/x-raw-rgb,width=15,framerate=10/1')
self.assertEquals(self.caps.__refcount__, 1)
self.structure = self.caps[0]
self.any = gst.Caps("ANY")
self.assertEquals(self.any.__refcount__, 1)
self.empty = gst.Caps()
self.assertEquals(self.empty.__refcount__, 1)
示例15: setUp
def setUp(self):
TestCase.setUp(self)
self.factory = StubSourceFactory('name')
caps = gst.Caps('video/x-raw-rgb')
self.stream = VideoStream(caps, pad_name='src0')
# source factories can't have input streams
self.failUnlessRaises(AssertionError,
self.factory.addInputStream, self.stream)
self.factory.addOutputStream(self.stream)
self.monitor = SignalMonitor(self.factory, 'bin-created', 'bin-released')