当前位置: 首页>>代码示例>>Python>>正文


Python TestCase.setUp方法代码示例

本文整理汇总了Python中common.TestCase.setUp方法的典型用法代码示例。如果您正苦于以下问题:Python TestCase.setUp方法的具体用法?Python TestCase.setUp怎么用?Python TestCase.setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common.TestCase的用法示例。


在下文中一共展示了TestCase.setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: from common import TestCase [as 别名]
# 或者: from common.TestCase import setUp [as 别名]
 def setUp(self):
     TestCase.setUp(self)
     filename = self.getFileName("dataset_testscalarflot")
     print("filename:", filename)
     self.f = h5py.File(filename, "w")
     self.data = np.array(42.5, dtype="f")
     self.dset = self.f.create_dataset("x", data=self.data)
开发者ID:HDFGroup,项目名称:h5pyd,代码行数:9,代码来源:test_dataset_getitem.py

示例2: setUp

# 需要导入模块: from common import TestCase [as 别名]
# 或者: from common.TestCase import setUp [as 别名]
    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)
开发者ID:alessandrod,项目名称:gst-python,代码行数:27,代码来源:test_pad.py

示例3: setUp

# 需要导入模块: from common import TestCase [as 别名]
# 或者: from common.TestCase import setUp [as 别名]
 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')
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:9,代码来源:test_event.py

示例4: setUp

# 需要导入模块: from common import TestCase [as 别名]
# 或者: from common.TestCase import setUp [as 别名]
 def setUp(self):
     TestCase.setUp(self)
     amix = find_mixer_element()
     if amix:
         self.mixer = amix.create()
     else:
         self.mixer = None
开发者ID:GStreamer,项目名称:gst-python,代码行数:9,代码来源:test_interface.py

示例5: setUp

# 需要导入模块: from common import TestCase [as 别名]
# 或者: from common.TestCase import setUp [as 别名]
 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)
开发者ID:Mathieu69,项目名称:Pitivi_Gargamel,代码行数:9,代码来源:test_track.py

示例6: setUp

# 需要导入模块: from common import TestCase [as 别名]
# 或者: from common.TestCase import setUp [as 别名]
 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)
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:9,代码来源:test_registry.py

示例7: setUp

# 需要导入模块: from common import TestCase [as 别名]
# 或者: from common.TestCase import setUp [as 别名]
 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
开发者ID:DrKenHo,项目名称:h5serv,代码行数:10,代码来源:test_dataset_getitem.py

示例8: setUp

# 需要导入模块: from common import TestCase [as 别名]
# 或者: from common.TestCase import setUp [as 别名]
 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, [])
开发者ID:bemasc,项目名称:pitivi,代码行数:11,代码来源:test_pipeline.py

示例9: setUp

# 需要导入模块: from common import TestCase [as 别名]
# 或者: from common.TestCase import setUp [as 别名]
 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)
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:11,代码来源:test_caps.py

示例10: setUp

# 需要导入模块: from common import TestCase [as 别名]
# 或者: from common.TestCase import setUp [as 别名]
    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)
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:11,代码来源:test_element.py

示例11: setUp

# 需要导入模块: from common import TestCase [as 别名]
# 或者: from common.TestCase import setUp [as 别名]
 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')
开发者ID:dparker18,项目名称:Pitivi,代码行数:12,代码来源:test_factories_base.py

示例12: setUp

# 需要导入模块: from common import TestCase [as 别名]
# 或者: from common.TestCase import setUp [as 别名]
    def setUp(self):
        TestCase.setUp(self)
        self.pipeline = gst.Pipeline('test-pipeline')
        source = gst.element_factory_make('fakesrc', 'source')
        sink = gst.element_factory_make('fakesink', 'sink')
        self.pipeline.add(source, sink)
        gst.element_link_many(source, sink)

        self.bus = self.pipeline.get_bus()
        self.assertEquals(self.bus.__gstrefcount__, 2)
        self.handler = self.bus.add_watch(self._message_received)
        self.assertEquals(self.bus.__gstrefcount__, 3)
        self.assertEquals(self.pipeline.__gstrefcount__, 1)

        self.loop = gobject.MainLoop()
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:17,代码来源:test_pipeline.py

示例13: setUp

# 需要导入模块: from common import TestCase [as 别名]
# 或者: from common.TestCase import setUp [as 别名]
    def setUp(self):
        TestCase.setUp(self)
        self.discoverer = Discoverer1()
        self.discoverer.current_uri = "meh"
        # don't plug the thumbnailing branch
        self.discoverer.current_uri = "file:///foo/bar"
        self.src = gst.Bin()
        self.discoverer.pipeline = self.src
        self.discoverer.current_duration = 10 * gst.SECOND
        self.factories = []
        self.error = None
        self.error_detail = None

        self.discoverer.connect("discovery-error", self.discoveryErrorCb)
        self.discoverer.connect("discovery-done", self.discoveryDoneCb)
开发者ID:dparker18,项目名称:Pitivi,代码行数:17,代码来源:test_discoverer.py

示例14: setUp

# 需要导入模块: from common import TestCase [as 别名]
# 或者: from common.TestCase import setUp [as 别名]
    def setUp(self):
        gst.info("setUp")
        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.src = SrcBin()
        self.src.prepare()
        self.sink = SinkBin()
        self.sink.prepare()
        self.assertEquals(self.src.__gstrefcount__, 1)
        self.assertEquals(sys.getrefcount(self.src), pygobject_2_13 and 2 or 3)
        self.assertEquals(self.sink.__gstrefcount__, 1)
        self.assertEquals(sys.getrefcount(self.sink), pygobject_2_13 and 2 or 3)
        gst.info("end of SetUp")
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:18,代码来源:test_ghostpad.py

示例15: setUp

# 需要导入模块: from common import TestCase [as 别名]
# 或者: from common.TestCase import setUp [as 别名]
 def setUp(self):
     TestCase.setUp(self)
     self.bin = gst.Bin("bin")
开发者ID:jayridge,项目名称:gst-python,代码行数:5,代码来源:test_bin.py


注:本文中的common.TestCase.setUp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。