Browse Source

No capabilities is not a power rule violation

Clara Hobbs 7 years ago
parent
commit
5493446e65
2 changed files with 5 additions and 1 deletions
  1. 4
    1
      pdbuddy/__init__.py
  2. 1
    0
      test_pdbuddy/__init__.py

+ 4
- 1
pdbuddy/__init__.py View File

495
     seen_15v = False
495
     seen_15v = False
496
     seen_20v = False
496
     seen_20v = False
497
     seen_normative_voltages = False
497
     seen_normative_voltages = False
498
-    if pdp <= 15:
498
+    if pdp == 0:
499
+        # No power is fine
500
+        seen_normative_voltages = True
501
+    elif pdp <= 15:
499
         # Below 15 W, make sure the PDP is available at 5 V.
502
         # Below 15 W, make sure the PDP is available at 5 V.
500
         for pdo in pdo_list:
503
         for pdo in pdo_list:
501
             if pdo.pdo_type == "fixed" and pdo.v == 5000:
504
             if pdo.pdo_type == "fixed" and pdo.v == 5000:

+ 1
- 0
test_pdbuddy/__init__.py View File

410
 
410
 
411
     def test_follows_power_rules_true(self):
411
     def test_follows_power_rules_true(self):
412
         # <= 15 W
412
         # <= 15 W
413
+        self.assertTrue(pdbuddy.follows_power_rules([]))
413
         self.assertTrue(pdbuddy.follows_power_rules([self.src_fixed_5v_1p5a]))
414
         self.assertTrue(pdbuddy.follows_power_rules([self.src_fixed_5v_1p5a]))
414
         self.assertTrue(pdbuddy.follows_power_rules([self.src_fixed_5v_3a]))
415
         self.assertTrue(pdbuddy.follows_power_rules([self.src_fixed_5v_3a]))
415
         self.assertTrue(pdbuddy.follows_power_rules([self.src_fixed_5v_3a,
416
         self.assertTrue(pdbuddy.follows_power_rules([self.src_fixed_5v_3a,

Loading…
Cancel
Save