示例#1
0
def test_persist():
    dev = dummy()
    assert dev.persist is False
    with patch.object(dev, 'hide') as mock:
        dev.cleanup()
    mock.assert_called_once_with()
    dev = dummy()
    dev.persist = True
    with patch.object(dev, 'hide') as mock:
        dev.cleanup()
    mock.assert_not_called()
示例#2
0
def test_init_no_bus():
    with patch.object(smbus2.SMBus, 'open') as mock:
        i2c(port=2, address=0x71)
    mock.assert_called_once_with(2)