當前位置: 首頁>>代碼示例>>Python>>正文


Python Conf.remove_option方法代碼示例

本文整理匯總了Python中galicaster.core.conf.Conf.remove_option方法的典型用法代碼示例。如果您正苦於以下問題:Python Conf.remove_option方法的具體用法?Python Conf.remove_option怎麽用?Python Conf.remove_option使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在galicaster.core.conf.Conf的用法示例。


在下文中一共展示了Conf.remove_option方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_get_hostname

# 需要導入模塊: from galicaster.core.conf import Conf [as 別名]
# 或者: from galicaster.core.conf.Conf import remove_option [as 別名]
 def test_get_hostname(self):
     conf = Conf(self.conf_file)
     conf.set('config', 'ingest', None)
     conf.set('basic', 'admin', 'True')
     conf.set('ingest', 'hostname', None)
     self.assertEqual('GCMobile-' + socket.gethostname(), conf.get_hostname())
     self.assertEqual(1, len(conf.get_tracks_in_oc_dict()))
     self.assertEqual({'capture.device.names': 'defaults'}, conf.get_tracks_in_oc_dict())
     conf.set('basic', 'admin', 'False')
     conf.set('ingest', 'hostname', None)
     self.assertEqual('GC-' + socket.gethostname(), conf.get_hostname())
     name = "123456_654321"
     conf.set('ingest', 'hostname', name)
     self.assertEqual(name, conf.get_hostname())
     a = conf.remove_option('ingest', 'hostname')
開發者ID:SussexLearningSystems,項目名稱:Galicaster,代碼行數:17,代碼來源:conf.py

示例2: TestFunctions

# 需要導入模塊: from galicaster.core.conf import Conf [as 別名]
# 或者: from galicaster.core.conf.Conf import remove_option [as 別名]

#.........這裏部分代碼省略.........
        shutil.copyfile(backup_conf_active, conf_file)
        os.remove(backup_conf_active)

    def test_profile_with_no_profiles_in_files(self):
        conf_file = get_resource('conf/conf.ini')
        conf_dist_file = get_resource('conf/conf_dist.ini')
        profiles_dir = get_resource('conf/profiles')
        conf = Conf(conf_file, conf_dist_file, profiles_dir)
        conf.reload()
        self.assertEqual(len(conf.get_profiles()), 1)


    def test_get_and_set(self):
        # GET data in conf-dist
        self.assertEqual('full', self.conf.get('ingest', 'workflow'))
        # GET data in conf
        self.assertEqual('track1', self.conf.get('track1', 'name'))
        # SET
        self.conf.set('section', 'key', 'value')
        self.assertEqual('value', self.conf.get('section', 'key'))


    def test_get_all(self):
        full = self.conf.get_all()
        user_conf = self.conf.get_all(False)
        self.assertTrue(len(full) > len(user_conf))


    def test_reload(self):
        self.conf.set('basic', 'temp', 'temporary')
        self.assertEqual('temporary', self.conf.get('basic', 'temp'))
        self.conf.set('basic', 'temp', 'newtemporary')
        self.assertEqual('newtemporary', self.conf.get('basic', 'temp'))
        self.conf.remove_option('basic', 'temp')
        self.assertEqual(None, self.conf.get('basic', 'temp'))
        self.conf.reload()
        self.assertEqual('newtemporary', self.conf.get('basic', 'temp'))


    def test_get_tracks_in_oc_dict(self):
        conf = self.conf.get_tracks_in_oc_dict()
        self.assertEqual(len(conf), 3*3 +1)
        self.assertEqual(conf['capture.device.names'], 'track1,track3,track2')
        self.assertEqual(conf['capture.device.track2.outputfile'], 'SCREEN.mpeg')
        self.assertEqual(conf['capture.device.track2.src'], '/dev/null')


    def test_init_track(self):
        track = Track()
        self.assertEqual(track.name, '')
        self.assertEqual(track.device, '')
        self.assertEqual(track.flavor, '')
        self.assertEqual(track.location, '')
        self.assertEqual(track.file, '')
        self.assertEqual(len(track), 5)

        track.name = 'v_name'
        track.device = 'v_device'
        track.flavor = 'v_flavor'
        track.location = 'v_location'
        track.file = 'v_file'

        self.assertEqual(track.name, 'v_name')
        self.assertEqual(track.device, 'v_device')
        self.assertEqual(track.flavor, 'v_flavor')
        self.assertEqual(track.location, 'v_location')
開發者ID:SussexLearningSystems,項目名稱:Galicaster,代碼行數:70,代碼來源:conf.py


注:本文中的galicaster.core.conf.Conf.remove_option方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。