def test_assemble_packet_no_crc(): assert etree_to_bytes(assemble_packet( E.dle())) == b'<packet><dle/></packet>'
def test_assemble_packet_crc(): assert etree_to_bytes(assemble_packet( E.dle(), True)) == b'<packet crc="4259D34E"><dle/></packet>'
def test_send_existing_command(printer): pkt = printer.send_command(E.dle(), True) assert pkt.dle.get('online') in ('yes', 'no')
def test_etree_to_bytes(): assert etree_to_bytes(E.dle()) == b'<dle/>'
def dle(self): return self.send_command(E.dle(), True).dle.attrib