瀏覽代碼

No capabilities is not a power rule violation

Clara Hobbs 7 年之前
父節點
當前提交
5493446e65
共有 2 個文件被更改,包括 5 次插入1 次删除
  1. 4
    1
      pdbuddy/__init__.py
  2. 1
    0
      test_pdbuddy/__init__.py

+ 4
- 1
pdbuddy/__init__.py 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存