def test_dtc(): assert d.dtc(m("4100" + "0104")) == [ ("P0104", "Mass or Volume Air Flow Circuit Intermittent"), ] # multiple codes assert d.dtc(m("4100" + "010480034123")) == [ ("P0104", "Mass or Volume Air Flow Circuit Intermittent"), ("B0003", ""), # unknown error codes return empty strings ("C0123", ""), ] # invalid code lengths are dropped assert d.dtc(m("4100" + "0104800341")) == [ ("P0104", "Mass or Volume Air Flow Circuit Intermittent"), ("B0003", ""), ] # 0000 codes are dropped assert d.dtc(m("4100" + "000001040000")) == [ ("P0104", "Mass or Volume Air Flow Circuit Intermittent"), ] # test multiple messages assert d.dtc(m("4100" + "0104") + m("4100" + "8003") + m("4100" + "0000")) == [ ("P0104", "Mass or Volume Air Flow Circuit Intermittent"), ("B0003", ""), ]
def test_dtc(): assert d.dtc(m("0104")) == ([ ("P0104", "Mass or Volume Air Flow Circuit Intermittent"), ], Unit.NONE) # multiple codes assert d.dtc(m("010480034123")) == ([ ("P0104", "Mass or Volume Air Flow Circuit Intermittent"), ("B0003", "Unknown error code"), ("C0123", "Unknown error code"), ], Unit.NONE) # invalid code lengths are dropped assert d.dtc(m("0104800341")) == ([ ("P0104", "Mass or Volume Air Flow Circuit Intermittent"), ("B0003", "Unknown error code"), ], Unit.NONE) # 0000 codes are dropped assert d.dtc(m("000001040000")) == ([ ("P0104", "Mass or Volume Air Flow Circuit Intermittent"), ], Unit.NONE) # test multiple messages assert d.dtc(m("0104") + m("8003") + m("0000")) == ([ ("P0104", "Mass or Volume Air Flow Circuit Intermittent"), ("B0003", "Unknown error code"), ], Unit.NONE)