def test_read_verbose(self): """When verbose channel provided, reads are echoed.""" s = Mock(read=Mock(return_value=b"passes")) verb = Mock() n = NodeMCU(s, verb) assert n.read(6) == b"passes" verb.write.assert_called_once_with(b"passes")
def test_read_timeout(self): """Make sure read fails when wrong response length received.""" s = Mock(read=Mock(return_value=b"fails")) n = NodeMCU(s) with pytest.raises(IOError): n.read(6)
def test_read(self): """Read wrapper should work as expected...""" s = Mock(read=Mock(return_value=b"passes")) n = NodeMCU(s) assert n.read(6) == b"passes"