def test_stats():
    m, ctl, config = init()
    m.load(config)

    cmd = TestCommand("stats", ["dummy"])
    ctl.process_command(cmd)

    m.scale("dummy", 2)
    time.sleep(0.1)

    cmd1 = TestCommand("stats", ["dummy"])
    ctl.process_command(cmd1)

    m.stop()
    m.run()

    assert isinstance(cmd.result, dict)
    assert "stats" in cmd.result
    stats = cmd.result['stats']
    assert isinstance(stats, dict)
    assert stats['name'] == "default.dummy"
    assert "stats" in stats
    assert len(stats['stats']) == 1
    assert stats['stats'][0]['pid'] == 1

    assert isinstance(cmd1.result, dict)
    stats = cmd1.result['stats']
    assert isinstance(stats, dict)
    assert stats['name'] == "default.dummy"
    assert stats in "stats"
    assert len(stats['stats']) == 3
dataset/ETHPy150Open benoitc/gaffer/test/test_controller.py/test_stats/swapped operands of `in`