def test_pure_commands(self):
        shape = (3,)
        y0 = np.random.rand(*shape)
        
        obs_spec = StreamSpec(id_stream=None,
                              streamels=make_streamels_1D_float(shape[0], 0.0, 1.0))
        cmd_spec = StreamSpec(id_stream=None,
                              streamels=make_streamels_1D_float(2, 0.0, 1.0))
            
        nuisance = ActiveNuisance()
        r0 = RandomRobot(BootSpec(obs_spec, cmd_spec), t0=0.0, y0=y0)
        robot = EquivRobotCausal(r0, nuisance)

        
        # bit off    
        rest1 = np.array([0.5, 0.5, 0.0])
        # bit on
        rest2 = np.array([0.5, 0.5, 1.0])
    
        robot.set_commands(rest1, 'rest')
        obs1 = robot.get_observations()
        
        robot.set_commands(rest2, 'rest')
        obs2 = robot.get_observations()
        
        assert_allclose(obs2.observations, 1 - obs1.observations)    
    def test_pure_commands(self):
        obs = StreamSpec(id_stream=None, streamels=make_streamels_rgb_float((10, 10)))
        cmd = StreamSpec(id_stream=None, streamels=make_streamels_1D_float(2, 0.0, 1.0))

        delta = 1.0
        n = 10  # in this case we have to match everything
        nuisance = PureCommandsNuisance(delta=delta, n=n)
        r0 = RandomRobot(BootSpec(obs, cmd), t0=0.0)
        robot = EquivRobotCausal(r0, nuisance)

        agent = RandomAgent()
        agent.init(robot.get_spec())

        # first observations should be available
        rest = robot.get_spec().get_commands().get_default_value()
        obs = robot.get_observations()

        self.assertEqual(obs.timestamp, 0)
        # now it is not available
        self.assertRaises(RobotObservations.NotReady, robot.get_observations)

        for i in range(4):
            robot.set_commands(rest, "rest")
            obs = robot.get_observations()
            assert_almost_equal(obs.timestamp, delta * (i + 1))
            self.assertRaises(RobotObservations.NotReady, robot.get_observations)