def TestPyVariant(o, is_generated):
    _TestPyVariant(o, is_generated, VARIANT(pythoncom.VT_UI1, 1))
    _TestPyVariant(o, is_generated, VARIANT((pythoncom.VT_ARRAY | pythoncom.VT_UI4), [1, 2, 3]))
    _TestPyVariant(o, is_generated, VARIANT(pythoncom.VT_BSTR, 'hello'))
    _TestPyVariant(o, is_generated, VARIANT((pythoncom.VT_ARRAY | pythoncom.VT_BSTR), ['hello', 'there']))

    def check_dispatch(got):
        assert isinstance(got._oleobj_, pythoncom.TypeIIDs[pythoncom.IID_IDispatch])
    _TestPyVariant(o, is_generated, VARIANT(pythoncom.VT_DISPATCH, o), check_dispatch)
    _TestPyVariant(o, is_generated, VARIANT((pythoncom.VT_ARRAY | pythoncom.VT_DISPATCH), [o]))
    v = VARIANT((pythoncom.VT_ARRAY | pythoncom.VT_VARIANT), [VARIANT(pythoncom.VT_UI4, 1), VARIANT(pythoncom.VT_UI4, 2), VARIANT(pythoncom.VT_UI4, 3)])
    _TestPyVariant(o, is_generated, v)
    _TestPyVariantFails(o, is_generated, VARIANT(pythoncom.VT_UI1, 'foo'), ValueError)
def TestPyVariant(o, is_generated):
    _TestPyVariant(o, is_generated, VARIANT(pythoncom.VT_UI1, 1))
    _TestPyVariant(o, is_generated, VARIANT((pythoncom.VT_ARRAY | pythoncom.VT_UI4), [1, 2, 3]))
    _TestPyVariant(o, is_generated, VARIANT(pythoncom.VT_BSTR, 'hello'))
    _TestPyVariant(o, is_generated, VARIANT((pythoncom.VT_ARRAY | pythoncom.VT_BSTR), ['hello', 'there']))

    def check_dispatch(got):
        assert isinstance(got._oleobj_, pythoncom.TypeIIDs[pythoncom.IID_IDispatch])
    _TestPyVariant(o, is_generated, VARIANT(pythoncom.VT_DISPATCH, o), check_dispatch)
    _TestPyVariant(o, is_generated, VARIANT((pythoncom.VT_ARRAY | pythoncom.VT_DISPATCH), [o]))
    v = VARIANT((pythoncom.VT_ARRAY | pythoncom.VT_VARIANT), [VARIANT(pythoncom.VT_UI4, 1), VARIANT(pythoncom.VT_UI4, 2), VARIANT(pythoncom.VT_UI4, 3)])
    _TestPyVariant(o, is_generated, v)
    _TestPyVariantFails(o, is_generated, VARIANT(pythoncom.VT_UI1, 'foo'), ValueError)