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,7 +495,10 @@ def follows_power_rules(pdo_list):
495 495
     seen_15v = False
496 496
     seen_20v = False
497 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 502
         # Below 15 W, make sure the PDP is available at 5 V.
500 503
         for pdo in pdo_list:
501 504
             if pdo.pdo_type == "fixed" and pdo.v == 5000:

+ 1
- 0
test_pdbuddy/__init__.py View File

@@ -410,6 +410,7 @@ class PDOListCalculationsTestCase(unittest.TestCase):
410 410
 
411 411
     def test_follows_power_rules_true(self):
412 412
         # <= 15 W
413
+        self.assertTrue(pdbuddy.follows_power_rules([]))
413 414
         self.assertTrue(pdbuddy.follows_power_rules([self.src_fixed_5v_1p5a]))
414 415
         self.assertTrue(pdbuddy.follows_power_rules([self.src_fixed_5v_3a]))
415 416
         self.assertTrue(pdbuddy.follows_power_rules([self.src_fixed_5v_3a,

Loading…
Cancel
Save