示例#1
0
 def assess_system(self):
     cpuinfo = extract(self.data, ['cpu', 'info'])
     if cpuinfo:
         return {
             'Hypervisor vendor':
             Grade.fact(cpuinfo.get('Hypervisor vendor'), False),
             'Virtualization type':
             Grade.fact(cpuinfo.get('Hypervisor vendor'), False),
         }
示例#2
0
 def rate(self):
     cpuinfo = extract(self.data, ['cpu', 'info'])
     if cpuinfo:
         return self.folding.fold(
             {
                 'Hypervisor vendor':
                 Grade.fact(cpuinfo.get('Hypervisor vendor'), False),
                 'Virtualization type':
                 Grade.fact(cpuinfo.get('Hypervisor vendor'), False),
             }, self.folding.SUBSYSTEM)
示例#3
0
 def test_grade_fact(self):
     self.assertEqual(Grade.fact(None, True), 1)
     self.assertEqual(Grade.fact(None), 10)
     self.assertEqual(Grade.fact('Anything', True), 10)
     self.assertEqual(Grade.fact('Anything'), 1)
     self.assertEqual(Grade.fact(15, True), 10)
     self.assertEqual(Grade.fact(15), 1)
     self.assertEqual(Grade.fact({'x': 'y'}, True), 10)
     self.assertEqual(Grade.fact({}, True), 10)
示例#4
0
 def test_grade_fact(self):
     self.assertEqual(Grade.fact(None, True), 1)
     self.assertEqual(Grade.fact(None, False), 10)
     self.assertEqual(Grade.fact("Anything", True), 10)
     self.assertEqual(Grade.fact("Anything", False), 1)
     self.assertEqual(Grade.fact(15, True), 10)
     self.assertEqual(Grade.fact(15, False), 1)
     self.assertEqual(Grade.fact({'x': 'y'}, True), 10)
     self.assertEqual(Grade.fact({}, True), 10)