Пример #1
0
    def test_iter_operator(self):
        mock_component_1 = object()
        mock_component_2 = object()
        row = messages.ActionRowComponent(
            type=1, components=[mock_component_1, mock_component_2])

        assert list(row) == [mock_component_1, mock_component_2]
Пример #2
0
    def test_getitem_operator_with_index(self):
        mock_component = object()
        row = messages.ActionRowComponent(
            type=1, components=[object(), mock_component,
                                object()])

        assert row[1] is mock_component
Пример #3
0
    def test_getitem_operator_with_slice(self):
        mock_component_1 = object()
        mock_component_2 = object()
        row = messages.ActionRowComponent(type=1,
                                          components=[
                                              object(), mock_component_1,
                                              object(), mock_component_2
                                          ])

        assert row[1:4:2] == [mock_component_1, mock_component_2]
Пример #4
0
    def test_len_operator(self):
        row = messages.ActionRowComponent(type=1,
                                          components=[object(),
                                                      object()])

        assert len(row) == 2