def test_hosts_and_roles_together():
    @roles('r1', 'r2')
    @hosts('d')
    def command():
        pass
    eq_hosts(command, ['a', 'b', 'c', 'd'], env={'roledefs': fake_roles})
    eq_effective_roles(command, ['r1', 'r2'], env={'roledefs': fake_roles})
Use of @roles and @hosts together results in union of both
dataset/ETHPy150Open fabric/fabric/tests/test_main.py/test_hosts_and_roles_together