On 12/06/2015 10:28, Ulrike Fischer wrote:
> I'm getting an error in this document and don't understand it ;-(
> 
> \documentclass{article}
> \usepackage{expl3}
> \begin{document}
> \ExplSyntaxOn
> 
> \keys_define:nn {test}
>  {
>   type    .choices:nn = { A , B }
>    {
>     blub
>    }, 
>  }
> 
> %Works as expected:
> \keys_if_choice_exist:nnnT { test } { type }{ C}
>   {
>    \keys_set:nn { test } {type=C}
>   } {choice~doesn't~exist!}
> 
> \def\testvalue{A} 
> 
> %Error
> \keys_if_choice_exist:nnnT { test } { type }{ \testvalue }
>   {
>    \keys_set:nn { test } {type=\testvalue}
>   } {choice~doesn't~exist!}
> \ExplSyntaxOff
> \end{document}
> 
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> !
> ! LaTeX error: "kernel/key-choice-unknown"
> !
> ! Key 'test/type' accepts only a fixed set of choices.
> !
> ! See the LaTeX3 documentation for further information.
> !
> ! For immediate help type H <return>.
> !...............................................  
> 
> Why is the T-branch executed in the second case? Is is a bug?

Yes: I see where this is. I'll fix shortly and update CTAN over the weekend.

P.S. Will also look at your TeX-sx question on key setting!
--
Joseph Wright