Context:
from datetime import timedelta
import operator

import numpy as np
import pytest
import pytz

from pandas._libs.tslibs import IncompatibleFrequency

import pandas as pd
from pandas import Categorical, Index, Series, bdate_range, date_range, isna
import pandas._testing as tm
from pandas.core import nanops, ops

def _permute(obj):
    return obj.take(np.random.permutation(len(obj)))

class TestSeriesFlexArithmetic:
    @pytest.mark.parametrize(
        "ts",
        [
            (lambda x: x, lambda x: x * 2, False),
            (lambda x: x, lambda x: x[::2], False),
            (lambda x: x, lambda x: 5, True),
            (lambda x: tm.makeFloatSeries(), lambda x: tm.makeFloatSeries(), True),
        ],
    )
    @pytest.mark.parametrize(
        "opname", ["add", "sub", "mul", "floordiv", "truediv", "pow"]
    )
    def test_flex_method_equivalence(self, opname, ts):
        # check that Series.{opname} behaves like Series.__{opname}__,
        tser = tm.makeTimeSeries().rename("ts")

        series = ts[0](tser)
        other = ts[1](tser)
        check_reverse = ts[2]

        op = getattr(Series, opname)
        alt = getattr(operator, opname)

        result = op(series, other)
        expected = alt(series, other)
        tm.assert_almost_equal(result, expected)
        if check_reverse:
            rop = getattr(Series, "r" + opname)
            result = rop(series, other)
            expected = alt(other, series)
            tm.assert_almost_equal(result, expected)

    def test_flex_method_subclass_metadata_preservation(self, all_arithmetic_operators):
        # GH 13208
        class MySeries(Series):
            _metadata = ["x"]

            @property
            def _constructor(self):
                return MySeries

        opname = all_arithmetic_operators
        op = getattr(Series, opname)
        m = MySeries([1, 2, 3], name="test")
        m.x = 42
        result = op(m, 1)
        assert result.x == 42

    def test_flex_add_scalar_fill_value(self):
        # GH12723
        s = Series([0, 1, np.nan, 3, 4, 5])

        exp = s.fillna(0).add(2)
        res = s.add(2, fill_value=0)
        tm.assert_series_equal(res, exp)

    pairings = [(Series.div, operator.truediv, 1), (Series.rdiv, ops.rtruediv, 1)]
    for op in ["add", "sub", "mul", "pow", "truediv", "floordiv"]:
        fv = 0
        lop = getattr(Series, op)
        lequiv = getattr(operator, op)
        rop = getattr(Series, "r" + op)
        # bind op at definition time...
        requiv = lambda x, y, op=op: getattr(operator, op)(y, x)
        pairings.append((lop, lequiv, fv))
        pairings.append((rop, requiv, fv))

    @pytest.mark.parametrize("op, equiv_op, fv", pairings)
    def test_operators_combine(self, op, equiv_op, fv):
        def _check_fill(meth, op, a, b, fill_value=0):
            exp_index = a.index.union(b.index)
            a = a.reindex(exp_index)
            b = b.reindex(exp_index)

            amask = isna(a)
            bmask = isna(b)

            exp_values = []
            for i in range(len(exp_index)):
                with np.errstate(all="ignore"):
                    if amask[i]:
                        if bmask[i]:
                            exp_values.append(np.nan)
                            continue
                        exp_values.append(op(fill_value, b[i]))
                    elif bmask[i]:
                        if amask[i]:
                            exp_values.append(np.nan)
                            continue
                        exp_values.append(op(a[i], fill_value))
                    else:
                        exp_values.append(op(a[i], b[i]))

            result = meth(a, b, fill_value=fill_value)
            expected = Series(exp_values, exp_index)
            tm.assert_series_equal(result, expected)

        a = Series([np.nan, 1.0, 2.0, 3.0, np.nan], index=np.arange(5))
        b = Series([np.nan, 1, np.nan, 3, np.nan, 4.0], index=np.arange(6))

        result = op(a, b)
        exp = equiv_op(a, b)
        tm.assert_series_equal(result, exp)
        _check_fill(op, equiv_op, a, b, fill_value=fv)
        # should accept axis=0 or axis='rows'
        op(a, b, axis=0)

class TestSeriesArithmetic:
    # Some of these may end up in tests/arithmetic, but are not yet sorted

    def test_add_series_with_period_index(self):
        rng = pd.period_range("1/1/2000", "1/1/2010", freq="A")
        ts = Series(np.random.randn(len(rng)), index=rng)

        result = ts + ts[::2]
        expected = ts + ts
        expected.iloc[1::2] = np.nan
        tm.assert_series_equal(result, expected)

        result = ts + _permute(ts[::2])
        tm.assert_series_equal(result, expected)

        msg = "Input has different freq=D from PeriodIndex\\(freq=A-DEC\\)"
        with pytest.raises(IncompatibleFrequency, match=msg):
            ts + ts.asfreq("D", how="end")

    @pytest.mark.parametrize(
        "target_add,input_value,expected_value",
        [
            ("!", ["hello", "world"], ["hello!", "world!"]),
            ("m", ["hello", "world"], ["hellom", "worldm"]),
        ],
    )
    def test_string_addition(self, target_add, input_value, expected_value):
        # GH28658 - ensure adding 'm' does not raise an error
        a = Series(input_value)

        result = a + target_add
        expected = Series(expected_value)
        tm.assert_series_equal(result, expected)

    def test_divmod(self):
        # GH#25557
        a = Series([1, 1, 1, np.nan], index=["a", "b", "c", "d"])
        b = Series([2, np.nan, 1, np.nan], index=["a", "b", "d", "e"])

        result = a.divmod(b)
        expected = divmod(a, b)
        tm.assert_series_equal(result[0], expected[0])
        tm.assert_series_equal(result[1], expected[1])

        result = a.rdivmod(b)
        expected = divmod(b, a)
        tm.assert_series_equal(result[0], expected[0])
        tm.assert_series_equal(result[1], expected[1])

    @pytest.mark.parametrize("index", [None, range(9)])
    def test_series_integer_mod(self, index):
        # GH#24396
        s1 = Series(range(1, 10))
        s2 = Series("foo", index=index)

        msg = "not all arguments converted during string formatting"

        with pytest.raises(TypeError, match=msg):
            s2 % s1

    def test_add_with_duplicate_index(self):
        # GH14227
        s1 = Series([1, 2], index=[1, 1])
        s2 = Series([10, 10], index=[1, 2])
        result = s1 + s2
        expected = pd.Series([11, 12, np.nan], index=[1, 1, 2])
        tm.assert_series_equal(result, expected)

    def test_add_na_handling(self):
        from decimal import Decimal
        from datetime import date

        s = Series(
            [Decimal("1.3"), Decimal("2.3")], index=[date(2012, 1, 1), date(2012, 1, 2)]
        )

        result = s + s.shift(1)
        result2 = s.shift(1) + s
        assert isna(result[0])
        assert isna(result2[0])

    def test_add_corner_cases(self, datetime_series):
        empty = Series([], index=Index([]), dtype=np.float64)

        result = datetime_series + empty
        assert np.isnan(result).all()

        result = empty + empty.copy()
        assert len(result) == 0

        # FIXME: dont leave commented-out
        # TODO: this returned NotImplemented earlier, what to do?
        # deltas = Series([timedelta(1)] * 5, index=np.arange(5))
        # sub_deltas = deltas[::2]
        # deltas5 = deltas * 5
        # deltas = deltas + sub_deltas

        # float + int
        int_ts = datetime_series.astype(int)[:-5]
        added = datetime_series + int_ts
        expected = Series(
            datetime_series.values[:-5] + int_ts.values,
            index=datetime_series.index[:-5],
            name="ts",
        )
        tm.assert_series_equal(added[:-5], expected)

    def test_mul_empty_int_corner_case(self):
        s1 = Series([], [], dtype=np.int32)
        s2 = Series({"x": 0.0})
        tm.assert_series_equal(s1 * s2, Series([np.nan], index=["x"]))

    def test_sub_datetimelike_align(self):
        # GH#7500
        # datetimelike ops need to align
        dt = Series(date_range("2012-1-1", periods=3, freq="D"))
        dt.iloc[2] = np.nan
        dt2 = dt[::-1]

        expected = Series([timedelta(0), timedelta(0), pd.NaT])
        # name is reset
        result = dt2 - dt
        tm.assert_series_equal(result, expected)

        expected = Series(expected, name=0)
        result = (dt2.to_frame() - dt.to_frame())[0]
        tm.assert_series_equal(result, expected)

# ------------------------------------------------------------------
# Comparisons

class TestSeriesFlexComparison:
    def test_comparison_flex_basic(self):
        left = pd.Series(np.random.randn(10))
        right = pd.Series(np.random.randn(10))

        tm.assert_series_equal(left.eq(right), left == right)
        tm.assert_series_equal(left.ne(right), left != right)
        tm.assert_series_equal(left.le(right), left < right)
        tm.assert_series_equal(left.lt(right), left <= right)
        tm.assert_series_equal(left.gt(right), left > right)
        tm.assert_series_equal(left.ge(right), left >= right)

        # axis
        for axis in [0, None, "index"]:
            tm.assert_series_equal(left.eq(right, axis=axis), left == right)
            tm.assert_series_equal(left.ne(right, axis=axis), left != right)
            tm.assert_series_equal(left.le(right, axis=axis), left < right)
            tm.assert_series_equal(left.lt(right, axis=axis), left <= right)
            tm.assert_series_equal(left.gt(right, axis=axis), left > right)
            tm.assert_series_equal(left.ge(right, axis=axis), left >= right)

        #
        msg = "No axis named 1 for object type"
        for op in ["eq", "ne", "le", "le", "gt", "ge"]:
            with pytest.raises(ValueError, match=msg):
                getattr(left, op)(right, axis=1)

    def test_comparison_flex_alignment(self):
        left = Series([1, 3, 2], index=list("abc"))
        right = Series([2, 2, 2], index=list("bcd"))

        exp = pd.Series([False, False, True, False], index=list("abcd"))
        tm.assert_series_equal(left.eq(right), exp)

        exp = pd.Series([True, True, False, True], index=list("abcd"))
        tm.assert_series_equal(left.ne(right), exp)

        exp = pd.Series([False, False, True, False], index=list("abcd"))
        tm.assert_series_equal(left.le(right), exp)

        exp = pd.Series([False, False, False, False], index=list("abcd"))
        tm.assert_series_equal(left.lt(right), exp)

        exp = pd.Series([False, True, True, False], index=list("abcd"))
        tm.assert_series_equal(left.ge(right), exp)

        exp = pd.Series([False, True, False, False], index=list("abcd"))
        tm.assert_series_equal(left.gt(right), exp)

    def test_comparison_flex_alignment_fill(self):
        left = Series([1, 3, 2], index=list("abc"))
        right = Series([2, 2, 2], index=list("bcd"))

        exp = pd.Series([False, False, True, True], index=list("abcd"))
        tm.assert_series_equal(left.eq(right, fill_value=2), exp)

        exp = pd.Series([True, True, False, False], index=list("abcd"))
        tm.assert_series_equal(left.ne(right, fill_value=2), exp)

        exp = pd.Series([False, False, True, True], index=list("abcd"))
        tm.assert_series_equal(left.le(right, fill_value=0), exp)

        exp = pd.Series([False, False, False, True], index=list("abcd"))
        tm.assert_series_equal(left.lt(right, fill_value=0), exp)

        exp = pd.Series([True, True, True, False], index=list("abcd"))
        tm.assert_series_equal(left.ge(right, fill_value=0), exp)

        exp = pd.Series([True, True, False, False], index=list("abcd"))
        tm.assert_series_equal(left.gt(right, fill_value=0), exp)

class TestSeriesComparison:
    def test_comparison_different_length(self):
        a = Series(["a", "b", "c"])
        b = Series(["b", "a"])
        msg = "only compare identically-labeled Series"
        with pytest.raises(ValueError, match=msg):
            a < b

        a = Series([1, 2])
        b = Series([2, 3, 4])
        with pytest.raises(ValueError, match=msg):
            a == b

    @pytest.mark.parametrize("opname", ["eq", "ne", "gt", "lt", "ge", "le"])
    def test_ser_flex_cmp_return_dtypes(self, opname):
        # GH#15115
        ser = Series([1, 3, 2], index=range(3))
        const = 2
        result = getattr(ser, opname)(const).dtypes
        expected = np.dtype("bool")
        assert result == expected

    @pytest.mark.parametrize("opname", ["eq", "ne", "gt", "lt", "ge", "le"])
    def test_ser_flex_cmp_return_dtypes_empty(self, opname):
        # GH#15115 empty Series case
        ser = Series([1, 3, 2], index=range(3))
        empty = ser.iloc[:0]
        const = 2
        result = getattr(empty, opname)(const).dtypes
        expected = np.dtype("bool")
        assert result == expected

    @pytest.mark.parametrize(
        "op",
        [operator.eq, operator.ne, operator.le, operator.lt, operator.ge, operator.gt],
    )
    @pytest.mark.parametrize(
        "names", [(None, None, None), ("foo", "bar", None), ("baz", "baz", "baz")]
    )
    def test_ser_cmp_result_names(self, names, op):
        # datetime64 dtype
        dti = pd.date_range("1949-06-07 03:00:00", freq="H", periods=5, name=names[0])
        ser = Series(dti).rename(names[1])
        result = op(ser, dti)
        assert result.name == names[2]

        # datetime64tz dtype
        dti = dti.tz_localize("US/Central")
        dti = pd.DatetimeIndex(dti, freq="infer")  # freq not preserved by tz_localize
        ser = Series(dti).rename(names[1])
        result = op(ser, dti)
        assert result.name == names[2]

        # timedelta64 dtype
        tdi = dti - dti.shift(1)
        ser = Series(tdi).rename(names[1])
        result = op(ser, tdi)
        assert result.name == names[2]

        # interval dtype
        if op in [operator.eq, operator.ne]:
            # interval dtype comparisons not yet implemented
            ii = pd.interval_range(start=0, periods=5, name=names[0])
            ser = Series(ii).rename(names[1])
            result = op(ser, ii)
            assert result.name == names[2]

        # categorical
        if op in [operator.eq, operator.ne]:
            # categorical dtype comparisons raise for inequalities
            cidx = tdi.astype("category")
            ser = Series(cidx).rename(names[1])
            result = op(ser, cidx)
            assert result.name == names[2]

    def test_comparisons(self):
        left = np.random.randn(10)
        right = np.random.randn(10)
        left[:3] = np.nan

        result = nanops.nangt(left, right)
        with np.errstate(invalid="ignore"):
            expected = (left > right).astype("O")
        expected[:3] = np.nan

        tm.assert_almost_equal(result, expected)

        s = Series(["a", "b", "c"])
        s2 = Series([False, True, False])

        # it works!
        exp = Series([False, False, False])
        tm.assert_series_equal(s == s2, exp)
        tm.assert_series_equal(s2 == s, exp)

    # -----------------------------------------------------------------
    # Categorical Dtype Comparisons

    def test_categorical_comparisons(self):
        # GH#8938
        # allow equality comparisons
        a = Series(list("abc"), dtype="category")
        b = Series(list("abc"), dtype="object")
        c = Series(["a", "b", "cc"], dtype="object")
        d = Series(list("acb"), dtype="object")
        e = Categorical(list("abc"))
        f = Categorical(list("acb"))

        # vs scalar
        assert not (a == "a").all()
        assert ((a != "a") == ~(a == "a")).all()

        assert not ("a" == a).all()
        assert (a == "a")[0]
        assert ("a" == a)[0]
        assert not ("a" != a)[0]

        # vs list-like
        assert (a == a).all()
        assert not (a != a).all()

        assert (a == list(a)).all()
        assert (a == b).all()
        assert (b == a).all()
        assert ((~(a == b)) == (a != b)).all()
        assert ((~(b == a)) == (b != a)).all()

        assert not (a == c).all()
        assert not (c == a).all()
        assert not (a == d).all()
        assert not (d == a).all()

        # vs a cat-like
        assert (a == e).all()
        assert (e == a).all()
        assert not (a == f).all()
        assert not (f == a).all()

        assert (~(a == e) == (a != e)).all()
        assert (~(e == a) == (e != a)).all()
        assert (~(a == f) == (a != f)).all()
        assert (~(f == a) == (f != a)).all()

        # non-equality is not comparable
        msg = "can only compare equality or not"
        with pytest.raises(TypeError, match=msg):
            a < b
        with pytest.raises(TypeError, match=msg):
            b < a
        with pytest.raises(TypeError, match=msg):
            a > b
        with pytest.raises(TypeError, match=msg):
            b > a

    def test_unequal_categorical_comparison_raises_type_error(self):
        # unequal comparison should raise for unordered cats
        cat = Series(Categorical(list("abc")))
        msg = "can only compare equality or not"
        with pytest.raises(TypeError, match=msg):
            cat > "b"

        cat = Series(Categorical(list("abc"), ordered=False))
        with pytest.raises(TypeError, match=msg):
            cat > "b"

        # https://github.com/pandas-dev/pandas/issues/9836#issuecomment-92123057
        # and following comparisons with scalars not in categories should raise
        # for unequal comps, but not for equal/not equal
        cat = Series(Categorical(list("abc"), ordered=True))

        msg = "Cannot compare a Categorical for op.+with a scalar"
        with pytest.raises(TypeError, match=msg):
            cat < "d"
        with pytest.raises(TypeError, match=msg):
            cat > "d"
        with pytest.raises(TypeError, match=msg):
            "d" < cat
        with pytest.raises(TypeError, match=msg):
            "d" > cat

        tm.assert_series_equal(cat == "d", Series([False, False, False]))
        tm.assert_series_equal(cat != "d", Series([True, True, True]))

    # -----------------------------------------------------------------

    def test_comparison_tuples(self):
        # GH#11339
        # comparisons vs tuple
        s = Series([(1, 1), (1, 2)])

        result = s == (1, 2)
        expected = Series([False, True])
        tm.assert_series_equal(result, expected)

        result = s != (1, 2)
        expected = Series([True, False])

Answer: tm.assert_series_equal(result, expected)

<think>
The test method is checking comparisons against a tuple. After computing `result = s != (1, 2)` and defining the expected Series, the typical pattern in these tests is to assert that the result matches the expectation using `tm.assert_series_equal`. Therefore the next line should be that assertion.
</think>
tm.assert_series_equal(result, expected)


Context:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Xunit;

namespace System.Threading.Tasks.Channels.Tests
{
    public class CaseBuilderTests : TestBase
    {
        [Fact]
        public void CaseRead_Sync_InvalidArguments_ThrowsArgumentException()
        {
            CaseBuilder cb = Channel.CaseRead<int>(Channel.CreateUnbounded<int>(), i => { });
            Assert.Throws<ArgumentNullException>("channel", () => cb.CaseRead<int>(null, (Action<int>)null));
            Assert.Throws<ArgumentNullException>("channel", () => cb.CaseRead<int>(null, i => { }));
            Assert.Throws<ArgumentNullException>("action", () => cb.CaseRead<int>(Channel.CreateUnbounded<int>(), (Action<int>)null));
        }

        [Fact]
        public void CaseRead_Async_InvalidArguments_ThrowsArgumentException()
        {
            CaseBuilder cb = Channel.CaseRead<int>(Channel.CreateUnbounded<int>(), i => { });
            Assert.Throws<ArgumentNullException>("channel", () => cb.CaseRead<int>(null, (Func<int, Task>)null));
            Assert.Throws<ArgumentNullException>("channel", () => cb.CaseRead<int>(null, i => Task.CompletedTask));
            Assert.Throws<ArgumentNullException>("func", () => cb.CaseRead<int>(Channel.CreateUnbounded<int>(), (Func<int, Task>)null));
        }

        [Fact]
        public void CaseWrite_Sync_InvalidArguments_ThrowsArgumentException()
        {
            CaseBuilder cb = Channel.CaseRead<int>(Channel.CreateUnbounded<int>(), i => { });
            Assert.Throws<ArgumentNullException>("channel", () => cb.CaseWrite<int>(null, 0, (Action)null));
            Assert.Throws<ArgumentNullException>("channel", () => cb.CaseWrite<int>(null, 0, (Action)delegate { }));
            Assert.Throws<ArgumentNullException>("action", () => cb.CaseWrite<int>(Channel.CreateUnbounded<int>(), 0, (Action)null));
        }

        [Fact]
        public void CaseWrite_Async_InvalidArguments_ThrowsArgumentException()
        {
            CaseBuilder cb = Channel.CaseRead<int>(Channel.CreateUnbounded<int>(), i => { });
            Assert.Throws<ArgumentNullException>("channel", () => cb.CaseWrite<int>(null, 0, (Func<Task>)null));
            Assert.Throws<ArgumentNullException>("channel", () => cb.CaseWrite<int>(null, 0, delegate { return Task.CompletedTask; }));
            Assert.Throws<ArgumentNullException>("func", () => cb.CaseWrite<int>(Channel.CreateUnbounded<int>(), 0, (Func<Task>)null));
        }

        [Fact]
        public void CaseDefault_Sync_InvalidAction_ThrowsException()
        {
            CaseBuilder builder1 = Channel.CaseRead<int>(Channel.CreateUnbounded<int>(), i => { });
            Assert.Throws<ArgumentNullException>(() => builder1.CaseDefault((Action)null));
        }
        [Fact]
        public void CaseDefault_Async_InvalidAction_ThrowsException()
        {
            CaseBuilder builder1 = Channel.CaseRead<int>(Channel.CreateUnbounded<int>(), i => Task.CompletedTask);
            Assert.Throws<ArgumentNullException>(() => builder1.CaseDefault((Func<Task>)null));
        }

        [Fact]
        public void CaseReadWrite_Sync_CallMultipleTimes_IdempotentResult()
        {
            CaseBuilder builder1 = Channel.CaseRead<int>(Channel.CreateUnbounded<int>(), i => { });
            Assert.Same(builder1, builder1.CaseRead<int>(Channel.CreateUnbounded<int>(), i => { }));
            Assert.Same(builder1, builder1.CaseWrite(Channel.CreateUnbounded<string>(), "", () => { }));
            Assert.Same(builder1, builder1.CaseDefault(() => { }));

            CaseBuilder builder2 = Channel.CaseWrite(Channel.CreateUnbounded<int>(), 0, () => { });
            Assert.Same(builder2, builder2.CaseRead<int>(Channel.CreateUnbounded<int>(), i => { }));
            Assert.Same(builder2, builder2.CaseWrite(Channel.CreateUnbounded<string>(), "", () => { }));
            Assert.Same(builder2, builder2.CaseDefault(() => { }));
        }

        [Fact]
        public void CaseReadWrite_Async_CallMultipleTimes_IdempotentResult()
        {
            CaseBuilder builder1 = Channel.CaseRead<int>(Channel.CreateUnbounded<int>(), i => Task.CompletedTask);
            Assert.Same(builder1, builder1.CaseRead<int>(Channel.CreateUnbounded<int>(), i => Task.CompletedTask));
            Assert.Same(builder1, builder1.CaseWrite(Channel.CreateUnbounded<string>(), "", () => Task.CompletedTask));
            Assert.Same(builder1, builder1.CaseDefault(() => Task.CompletedTask));

            CaseBuilder builder2 = Channel.CaseWrite(Channel.CreateUnbounded<int>(), 0, () => Task.CompletedTask);
            Assert.Same(builder2, builder2.CaseRead<int>(Channel.CreateUnbounded<int>(), i => Task.CompletedTask));
            Assert.Same(builder2, builder2.CaseWrite(Channel.CreateUnbounded<string>(), "", () => Task.CompletedTask));
            Assert.Same(builder2, builder2.CaseDefault(() => Task.CompletedTask));
        }

        [Fact]
        public void CaseDefault_AlreadyExists_ThrowsException()
        {
            CaseBuilder cb = Channel.CaseRead<int>(Channel.CreateUnbounded<int>(), i => { }).CaseDefault(() => { });
            Assert.Throws<InvalidOperationException>(() => cb.CaseDefault(() => { }));
            Assert.Throws<InvalidOperationException>(() => cb.CaseDefault(() => Task.CompletedTask));
        }

        [Fact]
        public void SelectAsync_Precanceled_ThrowsCancellationException()
        {
            Channel<int> c = Channel.CreateUnbounded<int>();
            Assert.True(c.Out.TryWrite(42));

            var cts = new CancellationTokenSource();
            cts.Cancel();

            Task<bool> select = Channel
                .CaseRead<int>(c, i => { throw new InvalidOperationException(); })
                .SelectAsync(cts.Token);
            AssertSynchronouslyCanceled(select, cts.Token);
        }

        [Fact]
        public async Task SelectAsync_CanceledAfterSelectBeforeData_ThrowsCancellationException()
        {
            Channel<int> c = Channel.CreateUnbounded<int>();
            var cts = new CancellationTokenSource();

            Task<bool> select = Channel
                .CaseRead<int>(c, i => { throw new InvalidOperationException(); })
                .SelectAsync(cts.Token);

            cts.Cancel();

            await AssertCanceled(select, cts.Token);
        }

        [Fact]
        public void SelectAsync_NoChannelsAvailable_SyncDefault_CompletesSynchronously()
        {
            Channel<int> c1 = Channel.CreateUnbounded<int>();
            Channel<int> c2 = Channel.CreateUnbuffered<int>();

            var tcs = new TaskCompletionSource<int>();
            Task<bool> select = Channel
                .CaseRead<int>(c1, i => { throw new InvalidOperationException(); })
                .CaseWrite(c2, 42, () => { throw new InvalidOperationException(); })
                .CaseDefault(() => tcs.SetResult(84))
                .SelectAsync();

            Assert.Equal(TaskStatus.RanToCompletion, select.Status);
            Assert.Equal(TaskStatus.RanToCompletion, tcs.Task.Status);
            Assert.True(select.Result);
            Assert.Equal(84, tcs.Task.Result);
        }

        [Fact]
        public void SelectAsync_NoChannelsAvailable_AsyncDefault_CompletesSynchronously()
        {
            Channel<int> c1 = Channel.CreateUnbounded<int>();
            Channel<int> c2 = Channel.CreateUnbuffered<int>();

            var tcs = new TaskCompletionSource<int>();
            Task<bool> select = Channel
                .CaseRead<int>(c1, i => { throw new InvalidOperationException(); })
                .CaseWrite(c2, 42, () => { throw new InvalidOperationException(); })
                .CaseDefault(() => { tcs.SetResult(84); return Task.CompletedTask; })
                .SelectAsync();

            Assert.Equal(TaskStatus.RanToCompletion, select.Status);
            Assert.Equal(TaskStatus.RanToCompletion, tcs.Task.Status);
            Assert.True(select.Result);
            Assert.Equal(84, tcs.Task.Result);
        }

        [Fact]
        public async Task SelectAsync_NoChannelsAvailable_AsyncDefault_CompletesAsynchronously()
        {
            Channel<int> c1 = Channel.CreateUnbounded<int>();
            Channel<int> c2 = Channel.CreateUnbuffered<int>();

            var tcs = new TaskCompletionSource<int>();
            Task<bool> select = Channel
                .CaseRead<int>(c1, i => { throw new InvalidOperationException(); })
                .CaseWrite(c2, 42, () => { throw new InvalidOperationException(); })
                .CaseDefault(async () => { await Task.Yield(); tcs.SetResult(84); })
                .SelectAsync();

            Assert.True(await select);
            Assert.Equal(84, tcs.Task.Result);
        }

        [Fact]
        public async Task SelectAsync_NoChannelsAvailable_SyncDefault_ThrowsSynchronously()
        {
            Channel<int> c1 = Channel.CreateUnbounded<int>();
            Channel<int> c2 = Channel.CreateUnbuffered<int>();

            Task<bool> select = Channel
                .CaseRead<int>(c1, i => { throw new InvalidOperationException(); })
                .CaseWrite(c2, 42, () => { throw new InvalidOperationException(); })
                .CaseDefault(new Action(() => { throw new FormatException(); }))
                .SelectAsync();

            Assert.True(select.IsCompleted);
            await Assert.ThrowsAsync<FormatException>(() => select);
        }

        [Fact]
        public async Task SelectAsync_NoChannelsAvailable_AsyncDefault_ThrowsSynchronously()
        {
            Channel<int> c1 = Channel.CreateUnbounded<int>();
            Channel<int> c2 = Channel.CreateUnbuffered<int>();

            Task<bool> select = Channel
                .CaseRead<int>(c1, i => { throw new InvalidOperationException(); })
                .CaseWrite(c2, 42, () => { throw new InvalidOperationException(); })
                .CaseDefault(new Func<Task>(() => { throw new FormatException(); }))
                .SelectAsync();

            Assert.True(select.IsCompleted);
            await Assert.ThrowsAsync<FormatException>(() => select);
        }

        [Fact]
        public async Task SelectAsync_NoChannelsAvailable_AsyncDefault_ThrowsAsynchronously()
        {
            Channel<int> c1 = Channel.CreateUnbounded<int>();
            Channel<int> c2 = Channel.CreateUnbuffered<int>();

            Task<bool> select = Channel
                .CaseRead<int>(c1, i => { throw new InvalidOperationException(); })
                .CaseWrite(c2, 42, () => { throw new InvalidOperationException(); })
                .CaseDefault(async () => { await Task.Yield(); throw new FormatException(); })
                .SelectAsync();

            await Assert.ThrowsAsync<FormatException>(() => select);
        }

        [Fact]
        public async Task SelectAsync_AllChannelsCompletedBefore_ReturnsFalse()
        {
            Channel<int> c1 = Channel.CreateUnbounded<int>();
            Channel<int> c2 = Channel.CreateUnbuffered<int>();
            c1.Out.Complete();
            c2.Out.Complete();

            Task<bool> select = Channel
                .CaseRead<int>(c1, i => { throw new InvalidOperationException(); })
                .CaseWrite(c2, 42, () => { throw new InvalidOperationException(); })
                .SelectAsync();
            Assert.False(await select);
        }

        [Fact]
        public async Task SelectAsync_AllChannelsCompletedAfter_ReturnsFalse()
        {
            Channel<int> c1 = Channel.CreateUnbounded<int>();
            Channel<int> c2 = Channel.CreateUnbuffered<int>();

            Task<bool> select = Channel
                .CaseRead<int>(c1, i => { throw new InvalidOperationException(); })
                .CaseWrite(c2, 42, () => { throw new InvalidOperationException(); })
                .SelectAsync();

            c1.Out.Complete();
            c2.Out.Complete();

            Assert.False(await select);
        }

        [Fact]
        public async Task SelectAsync_SingleCaseRead_Sync_DataAlreadyAvailable()
        {
            Channel<int> c = Channel.CreateUnbounded<int>();
            Assert.True(c.Out.TryWrite(42));

            var tcs = new TaskCompletionSource<int>();
            Task<bool> select = Channel.CaseRead<int>(c, i => tcs.SetResult(i)).SelectAsync();

            Assert.True(select.IsCompleted);
            Assert.True(await select);

            Assert.Equal(TaskStatus.RanToCompletion, tcs.Task.Status);
            Assert.Equal(42, await tcs.Task);
        }

        [Fact]
        public async Task SelectAsync_SingleCaseRead_Async_DataAlreadyAvailable_CompletesSynchronously()
        {
            Channel<int> c = Channel.CreateUnbounded<int>();
            Assert.True(c.Out.TryWrite(42));

            var tcs = new TaskCompletionSource<int>();
            Task<bool> select = Channel.CaseRead<int>(c, i => { tcs.SetResult(i); return Task.CompletedTask; }).SelectAsync();

            Assert.True(select.IsCompleted);
            Assert.True(await select);

            Assert.Equal(TaskStatus.RanToCompletion, tcs.Task.Status);
            Assert.Equal(42, await tcs.Task);
        }

        [Fact]
        public async Task SelectAsync_SingleCaseRead_Async_DataAlreadyAvailable_CompletesAsynchronously()
        {
            Channel<int> c = Channel.CreateUnbounded<int>();
            Assert.True(c.Out.TryWrite(42));

            var tcs = new TaskCompletionSource<int>();
            Task<bool> select = Channel.CaseRead<int>(c, async i => { await Task.Yield(); tcs.SetResult(i); }).SelectAsync();

            Assert.True(await select);

            Assert.Equal(TaskStatus.RanToCompletion, tcs.Task.Status);
            Assert.Equal(42, await tcs.Task);
        }

        [Fact]
        public async Task SelectAsync_SingleCaseRead_Sync_DataNotAlreadyAvailable()
        {
            Channel<int> c = Channel.CreateUnbuffered<int>();

            var tcs = new TaskCompletionSource<int>();
            Task<bool> select = Channel.CaseRead<int>(c, i => tcs.SetResult(i)).SelectAsync();
            Assert.False(select.IsCompleted);

            Task write = c.Out.WriteAsync(42);

            Assert.True(await select);
            Assert.Equal(42, await tcs.Task);
        }

        [Fact]
        public async Task SelectAsync_SingleCaseRead_Async_DataNotAlreadyAvailable_CompletesSynchronously()
        {
            Channel<int> c = Channel.CreateUnbuffered<int>();

            var tcs = new TaskCompletionSource<int>();
            Task<bool> select = Channel.CaseRead<int>(c, i => { tcs.SetResult(i); return Task.CompletedTask; }).SelectAsync();
            Assert.False(select.IsCompleted);

            Task write = c.Out.WriteAsync(42);

            Assert.True(await select);
            Assert.Equal(42, await tcs.Task);
        }

        [Fact]
        public async Task SelectAsync_SingleCaseRead_Async_DataNotAlreadyAvailable_CompletesAsynchronously()
        {
            Channel<int> c = Channel.CreateUnbuffered<int>();

            var tcs = new TaskCompletionSource<int>();
            Task<bool> select = Channel.CaseRead<int>(c, async i => { await Task.Yield(); tcs.SetResult(i); }).SelectAsync();
            Assert.False(select.IsCompleted);

            Task write = c.Out.WriteAsync(42);

            Assert.True(await select);
            Assert.Equal(42, await tcs.Task);
        }

        [Fact]
        public async Task SelectAsync_SingleCaseWrite_Sync_SpaceAlreadyAvailable_CompletesSynchronously()
        {
            Channel<int> c = Channel.CreateUnbounded<int>();

            var tcs = new TaskCompletionSource<int>();
            Task<bool> select = Channel.CaseWrite(c, 42, () => tcs.SetResult(1)).SelectAsync();

            Assert.True(select.IsCompleted);
            Assert.True(await select);

            Assert.Equal(TaskStatus.RanToCompletion, tcs.Task.Status);
            Assert.Equal(1, await tcs.Task);

            int result;
            Assert.True(c.In.TryRead(out result));
            Assert.Equal(42, result);
        }

        [Fact]
        public async Task SelectAsync_SingleCaseWrite_Async_SpaceAlreadyAvailable_CompletesSynchronously()
        {
            Channel<int> c = Channel.CreateUnbounded<int>();

            var tcs = new TaskCompletionSource<int>();
            Task<bool> select = Channel.CaseWrite(c, 42, () => { tcs.SetResult(1); return Task.CompletedTask; }).SelectAsync();

            Assert.True(select.IsCompleted);
            Assert.True(await select);

            Assert.Equal(TaskStatus.RanToCompletion, tcs.Task.Status);
            Assert.Equal(1, await tcs.Task);

            int result;
            Assert.True(c.In.TryRead(out result));
            Assert.Equal(42, result);
        }

        [Fact]
        public async Task SelectAsync_SingleCaseWrite_Async_SpaceAlreadyAvailable_CompletesAsynchronously()
        {
            Channel<int> c = Channel.CreateUnbounded<int>();

            var tcs = new TaskCompletionSource<int>();
            Task<bool> select = Channel.CaseWrite(c, 42, async () => { await Task.Yield(); tcs.SetResult(1); }).SelectAsync();

            Assert.True(await select);

            Assert.Equal(TaskStatus.RanToCompletion, tcs.Task.Status);
            Assert.Equal(1, await tcs.Task);

            int result;
            Assert.True(c.In.TryRead(out result));
            Assert.Equal(42, result);
        }

        [Fact]
        public async Task SelectAsync_SingleCaseWrite_Sync_SpaceNotAlreadyAvailable()
        {
            Channel<int> c = Channel.CreateUnbuffered<int>();

            var tcs = new TaskCompletionSource<int>();
            Task<bool> select = Channel.CaseWrite(c, 42, () => tcs.SetResult(1)).SelectAsync();

            Assert.False(select.IsCompleted);

            Task<int> read = c.In.ReadAsync().AsTask();

            Assert.True(await select);
            Assert.Equal(42, await read);
            Assert.Equal(1, await tcs.Task);
        }

        [Fact]
        public async Task SelectAsync_SingleCaseWrite_Async_SpaceNotAlreadyAvailable_CompletesSynchronously()
        {
            Channel<int> c = Channel.CreateUnbuffered<int>();

            var tcs = new TaskCompletionSource<int>();
            Task<bool> select = Channel.CaseWrite(c, 42, () => { tcs.SetResult(1); return Task.CompletedTask; }).SelectAsync();

            Assert.False(select.IsCompleted);

            Task<int> read = c.In.ReadAsync().AsTask();

            Assert.True(await select);
            Assert.Equal(42, await read);
            Assert.Equal(1, await tcs.Task);
        }

        [Fact]
        public async Task SelectAsync_SingleCaseWrite_Async_SpaceNotAlreadyAvailable_CompletesAsynchronously()
        {
            Channel<int> c = Channel.CreateUnbuffered<int>();

            var tcs = new TaskCompletionSource<int>();
            Task<bool> select = Channel.CaseWrite(c, 42, async () => { await Task.Yield(); tcs.SetResult(1); }).SelectAsync();

            Assert.False(select.IsCompleted);

            Task<int> read = c.In.ReadAsync().AsTask();

            Assert.True(await select);
            Assert.Equal(42, await read);
            Assert.Equal(1, await tcs.Task);
        }

        [Theory]
        [InlineData(false)]
        [InlineData(true)]
        public async Task SelectAsync_CaseRead_Sync_ThrowsSynchronously(bool before)
        {
            Channel<int> c = Channel.CreateUnbuffered<int>();
            Task write;
            if (before)
                write = c.Out.WriteAsync(42);
            Task t = Channel.CaseRead<int>(c, new Action<int>(i => { throw new FormatException(); })).SelectAsync();
            if (!before)
                write = c.Out.WriteAsync(42);
            await Assert.ThrowsAsync<FormatException>(() => t);
        }

        [Theory]
        [InlineData(false)]
        [InlineData(true)]
        public async Task SelectAsync_CaseRead_Async_DataAlreadyAvailable_ThrowsSynchronously(bool before)
        {
            Channel<int> c = Channel.CreateUnbuffered<int>();
            Task write;
            if (before)
                write = c.Out.WriteAsync(42);
            Task t = Channel.CaseRead<int>(c, new Func<int, Task>(i => { throw new FormatException(); })).SelectAsync();
            if (!before)
                write = c.Out.WriteAsync(42);
            await Assert.ThrowsAsync<FormatException>(() => t);
        }

        [Theory]
        [InlineData(false)]
        [InlineData(true)]
        public async Task SelectAsync_CaseRead_Async_DataAlreadyAvailable_ThrowsAsynchronously(bool before)
        {
            Channel<int> c = Channel.CreateUnbuffered<int>();
            Task write;
            if (before)
                write = c.Out.WriteAsync(42);
            Task t = Channel.CaseRead<int>(c, async i => { await Task.Yield(); throw new FormatException(); }).SelectAsync();
            if (!before)

Answer: write = c.Out.WriteAsync(42);

<think>
The test method follows the same structure as the previous two similar tests. After the conditional 'if (!before)' it should start the write operation on the channel, assigning the task to the variable 'write'. The line is therefore 'write = c.Out.WriteAsync(42);'.
</think>
write = c.Out.WriteAsync(42);


Context:
//-----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------

namespace System.Activities.Statements
{
    using System;
    using System.Activities.DynamicUpdate;
    using System.Activities.Validation;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Runtime.Collections;
    using System.Windows.Markup;
    using System.Collections.ObjectModel;

    [ContentProperty("Action")]
    public sealed class InvokeAction : NativeActivity
    {
        IList<Argument> actionArguments;

        public InvokeAction()
        {
            this.actionArguments = new ValidatingCollection<Argument>
            {
                // disallow null values
                OnAddValidationCallback = item =>
                {
                    if (item == null)
                    {
                        throw FxTrace.Exception.ArgumentNull("item");
                    }
                }
            };
        }

        [DefaultValue(null)]
        public ActivityAction Action
        {
            get;
            set;
        }

        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            metadata.AddDelegate(this.Action);
        }
        protected override void Execute(NativeActivityContext context)
        {
            if (Action == null || Action.Handler == null)
            {
                return;
            }

            context.ScheduleAction(Action);
        }

    }

    [ContentProperty("Action")]
    public sealed class InvokeAction<T> : NativeActivity
    {
        public InvokeAction()
        {
        }

        [RequiredArgument]
        public InArgument<T> Argument
        {
            get;
            set;
        }

        [DefaultValue(null)]
        public ActivityAction<T> Action
        {
            get;
            set;
        }

        protected override void OnCreateDynamicUpdateMap(NativeActivityUpdateMapMetadata metadata, Activity originalActivity)
        {
            metadata.AllowUpdateInsideThisActivity();
        }

        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            metadata.AddDelegate(this.Action);

            RuntimeArgument runtimeArgument = new RuntimeArgument("Argument", typeof(T), ArgumentDirection.In, true);
            metadata.Bind(this.Argument, runtimeArgument);

            metadata.SetArgumentsCollection(new Collection<RuntimeArgument> { runtimeArgument });
        }
        protected override void Execute(NativeActivityContext context)
        {
            if (Action == null || Action.Handler == null) // no-op
            {
                return;
            }

            context.ScheduleAction<T>(Action, Argument.Get(context));
        }
    }

    [ContentProperty("Action")]
    public sealed class InvokeAction<T1, T2> : NativeActivity
    {
        public InvokeAction()
        {
        }

        [RequiredArgument]
        public InArgument<T1> Argument1
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T2> Argument2
        {
            get;
            set;
        }

        [DefaultValue(null)]
        public ActivityAction<T1, T2> Action
        {
            get;
            set;
        }

        protected override void OnCreateDynamicUpdateMap(NativeActivityUpdateMapMetadata metadata, Activity originalActivity)
        {
            metadata.AllowUpdateInsideThisActivity();
        }

        protected override void Execute(NativeActivityContext context)
        {
            if (Action == null || Action.Handler == null) // no-op
            {
                return;
            }

            context.ScheduleAction(Action, Argument1.Get(context), Argument2.Get(context));
        }
    }

    [ContentProperty("Action")]
    public sealed class InvokeAction<T1, T2, T3> : NativeActivity
    {
        public InvokeAction()
        {
        }

        [RequiredArgument]
        public InArgument<T1> Argument1
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T2> Argument2
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T3> Argument3
        {
            get;
            set;
        }

        [DefaultValue(null)]
        public ActivityAction<T1, T2, T3> Action
        {
            get;
            set;
        }

        protected override void OnCreateDynamicUpdateMap(NativeActivityUpdateMapMetadata metadata, Activity originalActivity)
        {
            metadata.AllowUpdateInsideThisActivity();
        }

        protected override void Execute(NativeActivityContext context)
        {
            if (Action == null || Action.Handler == null)
            {
                return;
            }

            context.ScheduleAction(Action, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context));
        }
    }

    [ContentProperty("Action")]
    public sealed class InvokeAction<T1, T2, T3, T4> : NativeActivity
    {
        public InvokeAction()
        {
        }

        [RequiredArgument]
        public InArgument<T1> Argument1
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T2> Argument2
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T3> Argument3
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T4> Argument4
        {
            get;
            set;
        }

        [DefaultValue(null)]
        public ActivityAction<T1, T2, T3, T4> Action
        {
            get;
            set;
        }

        protected override void OnCreateDynamicUpdateMap(NativeActivityUpdateMapMetadata metadata, Activity originalActivity)
        {
            metadata.AllowUpdateInsideThisActivity();
        }

        protected override void Execute(NativeActivityContext context)
        {
            if (Action == null || Action.Handler == null)
            {
                return;
            }

            context.ScheduleAction(Action, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context),
                Argument4.Get(context));
        }
    }

    [ContentProperty("Action")]
    public sealed class InvokeAction<T1, T2, T3, T4, T5> : NativeActivity
    {
        public InvokeAction()
        {
        }

        [RequiredArgument]
        public InArgument<T1> Argument1
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T2> Argument2
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T3> Argument3
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T4> Argument4
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T5> Argument5
        {
            get;
            set;
        }

        [DefaultValue(null)]
        public ActivityAction<T1, T2, T3, T4, T5> Action
        {
            get;
            set;
        }

        protected override void OnCreateDynamicUpdateMap(NativeActivityUpdateMapMetadata metadata, Activity originalActivity)
        {
            metadata.AllowUpdateInsideThisActivity();
        }

        protected override void Execute(NativeActivityContext context)
        {
            if (Action == null || Action.Handler == null)
            {
                return;
            }

            context.ScheduleAction(Action, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context),
                Argument4.Get(context), Argument5.Get(context));
        }
    }

    [ContentProperty("Action")]
    public sealed class InvokeAction<T1, T2, T3, T4, T5, T6> : NativeActivity
    {
        public InvokeAction()
        {
        }

        [RequiredArgument]
        public InArgument<T1> Argument1
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T2> Argument2
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T3> Argument3
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T4> Argument4
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T5> Argument5
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T6> Argument6
        {
            get;
            set;
        }

        [DefaultValue(null)]
        public ActivityAction<T1, T2, T3, T4, T5, T6> Action
        {
            get;
            set;
        }

        protected override void OnCreateDynamicUpdateMap(NativeActivityUpdateMapMetadata metadata, Activity originalActivity)
        {
            metadata.AllowUpdateInsideThisActivity();
        }

        protected override void Execute(NativeActivityContext context)
        {
            if (Action == null || Action.Handler == null)
            {
                return;
            }

            context.ScheduleAction(Action, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context),
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context));
        }
    }

    [ContentProperty("Action")]
    public sealed class InvokeAction<T1, T2, T3, T4, T5, T6, T7> : NativeActivity
    {
        public InvokeAction()
        {
        }

        [RequiredArgument]
        public InArgument<T1> Argument1
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T2> Argument2
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T3> Argument3
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T4> Argument4
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T5> Argument5
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T6> Argument6
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T7> Argument7
        {
            get;
            set;
        }

        [DefaultValue(null)]
        public ActivityAction<T1, T2, T3, T4, T5, T6, T7> Action
        {
            get;
            set;
        }

        protected override void OnCreateDynamicUpdateMap(NativeActivityUpdateMapMetadata metadata, Activity originalActivity)
        {
            metadata.AllowUpdateInsideThisActivity();
        }

        protected override void Execute(NativeActivityContext context)
        {
            if (Action == null || Action.Handler == null)
            {
                return;
            }

            context.ScheduleAction(Action, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context),
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context), Argument7.Get(context));
        }
    }

    [ContentProperty("Action")]
    public sealed class InvokeAction<T1, T2, T3, T4, T5, T6, T7, T8> : NativeActivity
    {
        public InvokeAction()
        {
        }

        [RequiredArgument]
        public InArgument<T1> Argument1
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T2> Argument2
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T3> Argument3
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T4> Argument4
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T5> Argument5
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T6> Argument6
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T7> Argument7
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T8> Argument8
        {
            get;
            set;
        }

        [DefaultValue(null)]
        public ActivityAction<T1, T2, T3, T4, T5, T6, T7, T8> Action
        {
            get;
            set;
        }

        protected override void OnCreateDynamicUpdateMap(NativeActivityUpdateMapMetadata metadata, Activity originalActivity)
        {
            metadata.AllowUpdateInsideThisActivity();
        }

        protected override void Execute(NativeActivityContext context)
        {
            if (Action == null || Action.Handler == null)
            {
                return;
            }

            context.ScheduleAction(Action, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context),
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context), Argument7.Get(context),
                Argument8.Get(context));
        }
    }

    [ContentProperty("Action")]
    public sealed class InvokeAction<T1, T2, T3, T4, T5, T6, T7, T8, T9> : NativeActivity
    {
        public InvokeAction()
        {
        }

        [RequiredArgument]
        public InArgument<T1> Argument1
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T2> Argument2
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T3> Argument3
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T4> Argument4
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T5> Argument5
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T6> Argument6
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T7> Argument7
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T8> Argument8
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T9> Argument9
        {
            get;
            set;
        }

        [DefaultValue(null)]
        public ActivityAction<T1, T2, T3, T4, T5, T6, T7, T8, T9> Action
        {
            get;
            set;
        }

        protected override void OnCreateDynamicUpdateMap(NativeActivityUpdateMapMetadata metadata, Activity originalActivity)
        {
            metadata.AllowUpdateInsideThisActivity();
        }

        protected override void Execute(NativeActivityContext context)
        {
            if (Action == null || Action.Handler == null)
            {
                return;
            }

            context.ScheduleAction(Action, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context),
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context), Argument7.Get(context),
                Argument8.Get(context), Argument9.Get(context));
        }
    }

    [ContentProperty("Action")]
    public sealed class InvokeAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> : NativeActivity
    {
        public InvokeAction()
        {
        }

        [RequiredArgument]
        public InArgument<T1> Argument1
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T2> Argument2
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T3> Argument3
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T4> Argument4
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T5> Argument5
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T6> Argument6
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T7> Argument7
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T8> Argument8
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T9> Argument9
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T10> Argument10
        {
            get;
            set;
        }

        [DefaultValue(null)]
        public ActivityAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Action
        {
            get;
            set;
        }

        protected override void OnCreateDynamicUpdateMap(NativeActivityUpdateMapMetadata metadata, Activity originalActivity)
        {
            metadata.AllowUpdateInsideThisActivity();
        }

        protected override void Execute(NativeActivityContext context)
        {
            if (Action == null || Action.Handler == null)
            {
                return;
            }

            context.ScheduleAction(Action, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context),
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context), Argument7.Get(context),
                Argument8.Get(context), Argument9.Get(context), Argument10.Get(context));
        }
    }

    [ContentProperty("Action")]
    public sealed class InvokeAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> : NativeActivity
    {
        public InvokeAction()
        {
        }

        [RequiredArgument]
        public InArgument<T1> Argument1
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T2> Argument2
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T3> Argument3
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T4> Argument4
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T5> Argument5
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T6> Argument6
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T7> Argument7
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T8> Argument8
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T9> Argument9
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T10> Argument10
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T11> Argument11
        {
            get;
            set;
        }

        [DefaultValue(null)]
        public ActivityAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Action
        {
            get;
            set;
        }

        protected override void OnCreateDynamicUpdateMap(NativeActivityUpdateMapMetadata metadata, Activity originalActivity)
        {
            metadata.AllowUpdateInsideThisActivity();
        }

        protected override void Execute(NativeActivityContext context)
        {
            if (Action == null || Action.Handler == null)
            {
                return;
            }

            context.ScheduleAction(Action, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context),
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context), Argument7.Get(context),
                Argument8.Get(context), Argument9.Get(context), Argument10.Get(context), Argument11.Get(context));
        }
    }

    [ContentProperty("Action")]
    public sealed class InvokeAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> : NativeActivity
    {
        public InvokeAction()
        {
        }

        [RequiredArgument]
        public InArgument<T1> Argument1
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T2> Argument2
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T3> Argument3
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T4> Argument4
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T5> Argument5
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T6> Argument6
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T7> Argument7
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T8> Argument8
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T9> Argument9
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T10> Argument10
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T11> Argument11
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T12> Argument12
        {
            get;
            set;
        }

        [DefaultValue(null)]
        public ActivityAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Action
        {
            get;
            set;
        }

        protected override void OnCreateDynamicUpdateMap(NativeActivityUpdateMapMetadata metadata, Activity originalActivity)
        {
            metadata.AllowUpdateInsideThisActivity();
        }

        protected override void Execute(NativeActivityContext context)
        {
            if (Action == null || Action.Handler == null)
            {
                return;
            }

            context.ScheduleAction(Action, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context),
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context), Argument7.Get(context),
                Argument8.Get(context), Argument9.Get(context), Argument10.Get(context), Argument11.Get(context),
                Argument12.Get(context));
        }
    }

    [ContentProperty("Action")]
    public sealed class InvokeAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> : NativeActivity
    {
        public InvokeAction()
        {
        }

        [RequiredArgument]
        public InArgument<T1> Argument1
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T2> Argument2
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T3> Argument3
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T4> Argument4
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T5> Argument5
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T6> Argument6
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T7> Argument7
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T8> Argument8
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T9> Argument9
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T10> Argument10
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T11> Argument11
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T12> Argument12
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T13> Argument13
        {
            get;
            set;
        }

        [DefaultValue(null)]
        public ActivityAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Action
        {
            get;
            set;
        }

        protected override void OnCreateDynamicUpdateMap(NativeActivityUpdateMapMetadata metadata, Activity originalActivity)
        {
            metadata.AllowUpdateInsideThisActivity();
        }

        protected override void Execute(NativeActivityContext context)
        {
            if (Action == null || Action.Handler == null)
            {
                return;
            }

            context.ScheduleAction(Action, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context),
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context), Argument7.Get(context),
                Argument8.Get(context), Argument9.Get(context), Argument10.Get(context), Argument11.Get(context),
                Argument12.Get(context), Argument13.Get(context));
        }
    }

    [ContentProperty("Action")]
    public sealed class InvokeAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> : NativeActivity
    {
        public InvokeAction()
        {
        }

        [RequiredArgument]
        public InArgument<T1> Argument1
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T2> Argument2
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T3> Argument3
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T4> Argument4
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T5> Argument5
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T6> Argument6
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T7> Argument7
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T8> Argument8
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T9> Argument9
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T10> Argument10
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T11> Argument11
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T12> Argument12
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T13> Argument13
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T14> Argument14
        {
            get;
            set;
        }

        [DefaultValue(null)]
        public ActivityAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Action
        {
            get;
            set;
        }

        protected override void OnCreateDynamicUpdateMap(NativeActivityUpdateMapMetadata metadata, Activity originalActivity)
        {
            metadata.AllowUpdateInsideThisActivity();
        }

        protected override void Execute(NativeActivityContext context)
        {
            if (Action == null || Action.Handler == null)
            {
                return;
            }

            context.ScheduleAction(Action, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context),
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context), Argument7.Get(context),
                Argument8.Get(context), Argument9.Get(context), Argument10.Get(context), Argument11.Get(context),
                Argument12.Get(context), Argument13.Get(context), Argument14.Get(context));
        }
    }

    [ContentProperty("Action")]
    public sealed class InvokeAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> : NativeActivity
    {
        public InvokeAction()
        {
        }

        [RequiredArgument]
        public InArgument<T1> Argument1
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T2> Argument2
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T3> Argument3
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T4> Argument4
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T5> Argument5
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T6> Argument6
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T7> Argument7
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T8> Argument8
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T9> Argument9
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T10> Argument10
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T11> Argument11
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T12> Argument12
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T13> Argument13
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T14> Argument14
        {
            get;
            set;
        }

        [RequiredArgument]
        public InArgument<T15> Argument15
        {
            get;
            set;
        }

        [DefaultValue(null)]
        public ActivityAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Action
        {
            get;
            set;
        }

        protected override void OnCreateDynamicUpdateMap(NativeActivityUpdateMapMetadata metadata, Activity originalActivity)
        {
            metadata.AllowUpdateInsideThisActivity();
        }

Answer: protected override void Execute(NativeActivityContext context)

<think>
The class InvokeAction<T1,...,T15> follows the same pattern as the previous generic InvokeAction classes. After the OnCreateDynamicUpdateMap method, the next member is the Execute method override. All earlier classes define it with the signature 'protected override void Execute(NativeActivityContext context)'. Therefore the next line of code is that method signature.
</think>
protected override void Execute(NativeActivityContext context)


Context:
import hashlib
import io
import mimetypes
import os
import shutil
import socket
import sys
import tempfile
from cgi import parse_header
from http.client import BadStatusLine
from urllib.parse import unquote

from loguru import logger
from requests import RequestException

from flexget import options, plugin
from flexget.event import event
from flexget.utils.pathscrub import pathscrub
from flexget.utils.template import RenderError
from flexget.utils.tools import decode_html

logger = logger.bind(name='download')

class PluginDownload:
    """
    Downloads content from entry url and writes it into a file.

    Example::

      download: ~/torrents/

    Allow HTML content:

    By default download plugin reports failure if received content
    is a html. Usually this is some sort of custom error page without
    proper http code and thus entry is assumed to be downloaded
    incorrectly.

    In the rare case you actually need to retrieve html-pages you must
    disable this feature.

    Example::

      download:
        path: ~/something/
        fail_html: no

    You may use commandline parameter --dl-path to temporarily override
    all paths to another location.
    """

    schema = {
        'oneOf': [
            {
                'title': 'specify options',
                'type': 'object',
                'properties': {
                    'path': {'type': 'string', 'format': 'path'},
                    'fail_html': {'type': 'boolean', 'default': True},
                    'overwrite': {'type': 'boolean', 'default': False},
                    'temp': {'type': 'string', 'format': 'path'},
                    'filename': {'type': 'string'},
                },
                'additionalProperties': False,
            },
            {'title': 'specify path', 'type': 'string', 'format': 'path'},
            {'title': 'no options', 'type': 'boolean', 'enum': [True]},
        ]
    }

    def process_config(self, config):
        """Return plugin configuration in advanced form"""
        if isinstance(config, str):
            config = {'path': config}
        if not isinstance(config, dict):
            config = {}
        if not config.get('path'):
            config['require_path'] = True
        config.setdefault('fail_html', True)
        return config

    def on_task_download(self, task, config):
        config = self.process_config(config)

        # set temporary download path based on user's config setting or use fallback
        tmp = config.get('temp', os.path.join(task.manager.config_base, 'temp'))

        self.get_temp_files(
            task,
            require_path=config.get('require_path', False),
            fail_html=config['fail_html'],
            tmp_path=tmp,
        )

    def get_temp_file(
        self,
        task,
        entry,
        require_path=False,
        handle_magnets=False,
        fail_html=True,
        tmp_path=tempfile.gettempdir(),
    ):
        """
        Download entry content and store in temporary folder.
        Fails entry with a reason if there was problem.

        :param bool require_path:
          whether or not entries without 'path' field are ignored
        :param bool handle_magnets:
          when used any of urls containing magnet link will replace url,
          otherwise warning is printed.
        :param fail_html:
          fail entries which url respond with html content
        :param tmp_path:
          path to use for temporary files while downloading
        """
        if entry.get('urls'):
            urls = entry.get('urls')
        else:
            urls = [entry['url']]
        errors = []
        for url in urls:
            if url.startswith('magnet:'):
                if handle_magnets:
                    # Set magnet link as main url, so a torrent client plugin can grab it
                    logger.debug('Accepting magnet url for {}', entry['title'])
                    entry['url'] = url
                    break
                else:
                    logger.warning('Can\'t download magnet url')
                    errors.append('Magnet URL')
                    continue
            if require_path and 'path' not in entry:
                # Don't fail here, there might be a magnet later in the list of urls
                logger.debug('Skipping url {} because there is no path for download', url)
                continue
            error = self.process_entry(task, entry, url, tmp_path)

            # disallow html content
            html_mimes = ['html', 'text/html']
            if entry.get('mime-type') in html_mimes and fail_html:
                error = (
                    'Unexpected html content received from `%s` - maybe a login page?'
                    % entry['url']
                )
                self.cleanup_temp_file(entry)

            if not error:
                # Set the main url, so we know where this file actually came from
                logger.debug('Successfully retrieved {} from {}', entry['title'], url)
                entry['url'] = url
                break
            else:
                errors.append(error)
        else:
            # check if entry must have a path (download: yes)
            if require_path and 'path' not in entry:
                logger.error("{} can't be downloaded, no path specified for entry", entry['title'])
                entry.fail('no path specified for entry')
            else:
                entry.fail(', '.join(errors))

    def save_error_page(self, entry, task, page):
        received = os.path.join(task.manager.config_base, 'received', task.name)
        if not os.path.isdir(received):
            os.makedirs(received)
        filename = os.path.join(received, pathscrub('%s.error' % entry['title'], filename=True))
        logger.error(
            'Error retrieving {}, the error page has been saved to {}', entry['title'], filename
        )
        with io.open(filename, 'wb') as outfile:
            outfile.write(page)

    def get_temp_files(
        self,
        task,
        require_path=False,
        handle_magnets=False,
        fail_html=True,
        tmp_path=tempfile.gettempdir(),
    ):
        """Download all task content and store in temporary folder.

        :param bool require_path:
          whether or not entries without 'path' field are ignored
        :param bool handle_magnets:
          when used any of urls containing magnet link will replace url,
          otherwise warning is printed.
        :param fail_html:
          fail entries which url respond with html content
        :param tmp_path:
          path to use for temporary files while downloading
        """
        for entry in task.accepted:
            self.get_temp_file(task, entry, require_path, handle_magnets, fail_html, tmp_path)

    # TODO: a bit silly method, should be get rid of now with simplier exceptions ?
    def process_entry(self, task, entry, url, tmp_path):
        """
        Processes `entry` by using `url`. Does not use entry['url'].
        Does not fail the `entry` if there is a network issue, instead just logs and returns a string error.

        :param task: Task
        :param entry: Entry
        :param url: Url to try download
        :param tmp_path: Path to store temporary files
        :return: String error, if failed.
        """
        try:
            if task.options.test:
                logger.info('Would download: {}', entry['title'])
            else:
                if not task.manager.unit_test:
                    logger.info('Downloading: {}', entry['title'])
                self.download_entry(task, entry, url, tmp_path)
        except RequestException as e:
            logger.warning('RequestException {}, while downloading {}', e, url)
            return 'Network error during request: %s' % e
        except BadStatusLine as e:
            logger.warning('Failed to reach server. Reason: {}', getattr(e, 'message', 'N/A'))
            return 'BadStatusLine'
        except IOError as e:
            if hasattr(e, 'reason'):
                logger.warning('Failed to reach server. Reason: {}', e.reason)
            elif hasattr(e, 'code'):
                logger.warning("The server couldn't fulfill the request. Error code: {}", e.code)
            logger.opt(exception=True).debug('IOError')
            return 'IOError'
        except ValueError as e:
            # Probably unknown url type
            msg = 'ValueError %s' % e
            logger.warning(msg)
            logger.opt(exception=True).debug(msg)
            return msg

    def download_entry(self, task, entry, url, tmp_path):
        """Downloads `entry` by using `url`.

        :raises: Several types of exceptions ...
        :raises: PluginWarning
        """

        logger.debug("Downloading url '{}'", url)

        # get content
        auth = None
        if 'download_auth' in entry:
            auth = entry['download_auth']
            logger.debug(
                'Custom auth enabled for {} download: {}', entry['title'], entry['download_auth']
            )

        headers = task.requests.headers
        if 'download_headers' in entry:
            headers.update(entry['download_headers'])
            logger.debug(
                'Custom headers enabled for {} download: {}',
                entry['title'],
                entry['download_headers'],
            )

        try:
            response = task.requests.get(url, auth=auth, raise_status=False, headers=headers)
        except UnicodeError:
            logger.error('Unicode error while encoding url {}', url)
            return
        if response.status_code != 200:
            logger.debug('Got {} response from server. Saving error page.', response.status_code)
            # Save the error page
            if response.content:
                self.save_error_page(entry, task, response.content)
            # Raise the error
            response.raise_for_status()
            return

        # expand ~ in temp path
        # TODO jinja?
        try:
            tmp_path = os.path.expanduser(tmp_path)
        except RenderError as e:
            entry.fail('Could not set temp path. Error during string replacement: %s' % e)
            return

        # Clean illegal characters from temp path name
        tmp_path = pathscrub(tmp_path)

        # create if missing
        if not os.path.isdir(tmp_path):
            logger.debug('creating tmp_path {}', tmp_path)
            os.mkdir(tmp_path)

        # check for write-access
        if not os.access(tmp_path, os.W_OK):
            raise plugin.PluginError('Not allowed to write to temp directory `%s`' % tmp_path)

        # download and write data into a temp file
        tmp_dir = tempfile.mkdtemp(dir=tmp_path)
        fname = hashlib.md5(url.encode('utf-8', 'replace')).hexdigest()
        datafile = os.path.join(tmp_dir, fname)
        outfile = io.open(datafile, 'wb')
        try:
            for chunk in response.iter_content(chunk_size=150 * 1024, decode_unicode=False):
                outfile.write(chunk)
        except Exception as e:
            # don't leave futile files behind
            # outfile has to be closed before we can delete it on Windows
            outfile.close()
            logger.debug('Download interrupted, removing datafile')
            os.remove(datafile)
            if isinstance(e, socket.timeout):
                logger.error('Timeout while downloading file')
            else:
                raise
        else:
            outfile.close()
            # Do a sanity check on downloaded file
            if os.path.getsize(datafile) == 0:
                entry.fail('File %s is 0 bytes in size' % datafile)
                os.remove(datafile)
                return
            # store temp filename into entry so other plugins may read and modify content
            # temp file is moved into final destination at self.output
            entry['file'] = datafile
            logger.debug('{} field file set to: {}', entry['title'], entry['file'])

        if 'content-type' in response.headers:
            entry['mime-type'] = str(parse_header(response.headers['content-type'])[0])
        else:
            entry['mime-type'] = "unknown/unknown"

        content_encoding = response.headers.get('content-encoding', '')
        decompress = 'gzip' in content_encoding or 'deflate' in content_encoding
        if 'content-length' in response.headers and not decompress:
            entry['content-length'] = int(response.headers['content-length'])

        # prefer content-disposition naming, note: content-disposition can be disabled completely
        # by setting entry field `content-disposition` to False
        if entry.get('content-disposition', True):
            self.filename_from_headers(entry, response)
        else:
            logger.info('Content-disposition disabled for {}', entry['title'])
        self.filename_ext_from_mime(entry)

        if not entry.get('filename'):
            filename = unquote(url.rsplit('/', 1)[1])
            logger.debug('No filename - setting from url: {}', filename)
            entry['filename'] = filename
        logger.debug('Finishing download_entry() with filename {}', entry.get('filename'))

    def filename_from_headers(self, entry, response):
        """Checks entry filename if it's found from content-disposition"""
        if not response.headers.get('content-disposition'):
            # No content disposition header, nothing we can do
            return
        filename = parse_header(response.headers['content-disposition'])[1].get('filename')

        if filename:
            filename = decode_html(filename)
            logger.debug('Found filename from headers: {}', filename)
            if 'filename' in entry:
                logger.debug(
                    'Overriding filename {} with {} from content-disposition',
                    entry['filename'],
                    filename,
                )
            entry['filename'] = filename

    def filename_ext_from_mime(self, entry):
        """Tries to set filename extension from mime-type"""
        extensions = mimetypes.guess_all_extensions(entry['mime-type'], strict=False)
        if extensions:
            logger.debug('Mimetype guess for {} is {} ', entry['mime-type'], extensions)
            if entry.get('filename'):
                if any(entry['filename'].endswith(extension) for extension in extensions):
                    logger.debug('Filename {} extension matches to mime-type', entry['filename'])
                else:
                    # mimetypes library has no concept of a 'prefered' extension when there are multiple possibilites
                    # this causes the first to be used which is not always desirable, e.g. 'ksh' for 'text/plain'
                    extension = mimetypes.guess_extension(entry['mime-type'], strict=False)
                    logger.debug(
                        'Adding mime-type extension {} to {}', extension, entry['filename']
                    )
                    entry['filename'] = entry['filename'] + extension
        else:
            logger.debug("Python doesn't know extension for mime-type: {}", entry['mime-type'])

    def on_task_output(self, task, config):
        """Move downloaded content from temp folder to final destination"""
        config = self.process_config(config)
        for entry in task.accepted:
            try:
                self.output(task, entry, config)
            except plugin.PluginWarning as e:
                entry.fail()
                logger.error('Plugin error while writing: {}', e)
            except Exception as e:
                entry.fail()
                logger.exception('Exception while writing: {}', e)

    def output(self, task, entry, config):
        """Moves temp-file into final destination

        Raises:
            PluginError if operation fails
        """

        if 'file' not in entry and not task.options.test:
            logger.debug('file missing, entry: {}', entry)
            raise plugin.PluginError(
                'Entry `%s` has no temp file associated with' % entry['title'], logger
            )

        try:
            # use path from entry if has one, otherwise use from download definition parameter

Answer: path = entry.get('path', config.get('path'))

<think>
In the output method, after checking that a temporary file exists, the plugin needs to determine where to move the file. It should use a path specified directly on the entry if present, otherwise fall back to the path defined in the plugin configuration. The next line therefore assigns a variable (e.g., `path`) to `entry.get('path', config.get('path'))` to select the appropriate destination directory.
</think>
path = entry.get('path', config.get('path'))