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), }
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)
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)
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)