Beispiel #1
0
    def runTest(self):
        # We should get TypeError when the parameter is invalid
        self.assertRaises(TypeError, _ped.disk_flag_next)
        self.assertRaises(TypeError, _ped.disk_flag_next, 'blah')

        # First flag is 0, keep getting flags until we loop back around
        # to zero.  Make sure each flag we get is an integer.
        flag = _ped.disk_flag_next(0)
        self.assertEqual(type(flag).__name__, 'int')

        while True:
            flag = _ped.disk_flag_next(flag)
            if not flag:
                break
            self.assertEqual(type(flag).__name__, 'int')
Beispiel #2
0
    def runTest(self):
        # We should get TypeError when the parameter is invalid
        self.assertRaises(TypeError, _ped.disk_flag_next)
        self.assertRaises(TypeError, _ped.disk_flag_next, 'blah')

        # First flag is 0, keep getting flags until we loop back around
        # to zero.  Make sure each flag we get is an integer.
        flag = _ped.disk_flag_next(0)
        self.assertEqual(type(flag).__name__, 'int')

        while True:
            flag = _ped.disk_flag_next(flag)
            if not flag:
                break
            self.assertEqual(type(flag).__name__, 'int')
Beispiel #3
0
    def getPedDisk(self):
        """Return the _ped.Disk object contained in this Disk.  For internal
           module use only."""
        return self.__disk

# collect all disk types and store them in a hash
diskType = {}
__type = _ped.disk_type_get_next()
diskType[__type.name] = __type

while True:
    try:
        __type = _ped.disk_type_get_next(__type)
        diskType[__type.name] = __type
    except:
        break

# collect all disk flags and store them in a hash
diskFlag = {}
__flag = _ped.disk_flag_next(0)
diskFlag[__flag] = _ped.disk_flag_get_name(__flag)
__readFlags = True

while __readFlags:
    __flag = _ped.disk_flag_next(__flag)
    if not __flag:
        __readFlags = False
    else:
        diskFlag[__flag] = _ped.disk_flag_get_name(__flag)
Beispiel #4
0
    def getPedDisk(self):
        """Return the _ped.Disk object contained in this Disk.  For internal
           module use only."""
        return self.__disk

# collect all disk types and store them in a hash
diskType = {}
__type = _ped.disk_type_get_next()
diskType[__type.name] = __type

while True:
    try:
        __type = _ped.disk_type_get_next(__type)
        diskType[__type.name] = __type
    except (IndexError, TypeError, _ped.UnknownTypeException):
        break

# collect all disk flags and store them in a hash
diskFlag = {}
__flag = _ped.disk_flag_next(0)
diskFlag[__flag] = _ped.disk_flag_get_name(__flag)
__readFlags = True

while __readFlags:
    __flag = _ped.disk_flag_next(__flag)
    if not __flag:
        __readFlags = False
    else:
        diskFlag[__flag] = _ped.disk_flag_get_name(__flag)