repo_id stringclasses 400
values | commit_sha stringclasses 400
values | commit_index int32 0 951 | in_repo_split stringclasses 1
value | cross_repo_split stringclasses 1
value | test_file stringlengths 7 121 | test_function stringlengths 1 108 | assertion_type stringclasses 32
values | difficulty stringclasses 8
values | context_lines int32 3 600 | prefix large_stringlengths 44 113k | target large_stringlengths 1 498 | anchor_sha stringclasses 400
values | anchor_index int32 0 951 | qna_source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
JoshuaC215/agent-service-toolkit | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | train | train | tests/service/test_service_streaming.py | test_create_ai_message_filters_and_passes_through | assert | variable | 41 | import pytest
from langchain_core.messages import AIMessage
from service.service import _create_ai_message
@pytest.mark.parametrize(
"parts, expected",
[
# 1) Basic content + tool_calls
(
{"content": "Hello", "tool_calls": []},
{"content": "Hello", "tool_calls": []},
... | val | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | v2_extractor_at_anchor |
JoshuaC215/agent-service-toolkit | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | train | train | tests/service/test_service_streaming.py | test_create_ai_message_missing_required_content_raises | pytest.raises | variable | 12 | import pytest
from langchain_core.messages import AIMessage
from service.service import _create_ai_message
def test_create_ai_message_missing_required_content_raises():
"""
AIMessage requires 'content'; if missing, _create_ai_message should
bubble up the TypeError from the constructor.
"""
with p... | TypeError) | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | v2_extractor_at_anchor |
JoshuaC215/agent-service-toolkit | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | train | train | tests/service/test_utils.py | test_messages_from_langchain | assert | string_literal | 14 | from langchain_core.messages import AIMessage, HumanMessage, SystemMessage, ToolCall, ToolMessage
from service.utils import langchain_to_chat_message
def test_messages_from_langchain() -> None:
lc_human_message = HumanMessage(content="Hello, world!")
human_message = langchain_to_chat_message(lc_human_message)... | "ai" | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | v2_extractor_at_anchor |
JoshuaC215/agent-service-toolkit | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | train | train | tests/service/test_utils.py | test_messages_from_langchain | assert | string_literal | 21 | from langchain_core.messages import AIMessage, HumanMessage, SystemMessage, ToolCall, ToolMessage
from service.utils import langchain_to_chat_message
def test_messages_from_langchain() -> None:
lc_human_message = HumanMessage(content="Hello, world!")
human_message = langchain_to_chat_message(lc_human_message)... | "123" | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | v2_extractor_at_anchor |
JoshuaC215/agent-service-toolkit | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | train | train | tests/service/test_utils.py | test_messages_from_langchain | assert | string_literal | 19 | from langchain_core.messages import AIMessage, HumanMessage, SystemMessage, ToolCall, ToolMessage
from service.utils import langchain_to_chat_message
def test_messages_from_langchain() -> None:
lc_human_message = HumanMessage(content="Hello, world!")
human_message = langchain_to_chat_message(lc_human_message)... | "tool" | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | v2_extractor_at_anchor |
JoshuaC215/agent-service-toolkit | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | train | train | tests/service/test_utils.py | test_message_run_id_usage | assert | variable | 11 | from langchain_core.messages import AIMessage, HumanMessage, SystemMessage, ToolCall, ToolMessage
from service.utils import langchain_to_chat_message
def test_message_run_id_usage() -> None:
run_id = "847c6285-8fc9-4560-a83f-4e6285809254"
lc_message = AIMessage(content="Hello, world!")
ai_message = langch... | run_id | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | v2_extractor_at_anchor |
JoshuaC215/agent-service-toolkit | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | train | train | tests/service/test_utils.py | test_messages_from_langchain | assert | string_literal | 9 | from langchain_core.messages import AIMessage, HumanMessage, SystemMessage, ToolCall, ToolMessage
from service.utils import langchain_to_chat_message
def test_messages_from_langchain() -> None:
lc_human_message = HumanMessage(content="Hello, world!")
human_message = langchain_to_chat_message(lc_human_message)... | "human" | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | v2_extractor_at_anchor |
JoshuaC215/agent-service-toolkit | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | train | train | tests/service/test_utils.py | test_messages_tool_calls | assert | string_literal | 10 | from langchain_core.messages import AIMessage, HumanMessage, SystemMessage, ToolCall, ToolMessage
from service.utils import langchain_to_chat_message
def test_messages_tool_calls() -> None:
tool_call = ToolCall(name="test_tool", args={"x": 1, "y": 2}, id="call_Jja7")
lc_ai_message = AIMessage(content="", tool... | "call_Jja7" | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | v2_extractor_at_anchor |
JoshuaC215/agent-service-toolkit | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | train | train | tests/service/test_utils.py | test_messages_tool_calls | assert | string_literal | 11 | from langchain_core.messages import AIMessage, HumanMessage, SystemMessage, ToolCall, ToolMessage
from service.utils import langchain_to_chat_message
def test_messages_tool_calls() -> None:
tool_call = ToolCall(name="test_tool", args={"x": 1, "y": 2}, id="call_Jja7")
lc_ai_message = AIMessage(content="", tool... | "test_tool" | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | v2_extractor_at_anchor |
JoshuaC215/agent-service-toolkit | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | train | train | tests/service/test_utils.py | test_messages_from_langchain | assert | string_literal | 10 | from langchain_core.messages import AIMessage, HumanMessage, SystemMessage, ToolCall, ToolMessage
from service.utils import langchain_to_chat_message
def test_messages_from_langchain() -> None:
lc_human_message = HumanMessage(content="Hello, world!")
human_message = langchain_to_chat_message(lc_human_message)... | "Hello, world!" | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | v2_extractor_at_anchor |
JoshuaC215/agent-service-toolkit | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | train | train | tests/service/test_utils.py | test_messages_tool_calls | assert | collection | 12 | from langchain_core.messages import AIMessage, HumanMessage, SystemMessage, ToolCall, ToolMessage
from service.utils import langchain_to_chat_message
def test_messages_tool_calls() -> None:
tool_call = ToolCall(name="test_tool", args={"x": 1, "y": 2}, id="call_Jja7")
lc_ai_message = AIMessage(content="", tool... | {"x": 1, "y": 2} | 3b6f9626e9fe5d060e4f8bfb5a312c0d495c481f | 30 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_channel.py | test_channel_video_list | assert | variable | 23 | from unittest import mock
from pytubefix import Channel
@mock.patch('pytubefix.request.get')
def test_channel_video_list(request_get, channel_videos_html):
request_get.return_value = channel_videos_html
c = Channel('https://www.youtube.com/c/ProgrammingKnowledge/videos')
first_ten = [
'https://ww... | first_ten | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_channel.py | test_videos_html | assert | variable | 11 | from unittest import mock
from pytubefix import Channel
@mock.patch('pytubefix.request.get')
def test_videos_html(request_get, channel_videos_html):
request_get.return_value = channel_videos_html
c = Channel('https://www.youtube.com/c/ProgrammingKnowledge')
assert c.html == | channel_videos_html | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_channel.py | test_channel_name | assert | string_literal | 11 | from unittest import mock
from pytubefix import Channel
@mock.patch('pytubefix.request.get')
def test_channel_name(request_get, channel_videos_html):
request_get.return_value = channel_videos_html
c = Channel('https://www.youtube.com/c/ProgrammingKnowledge/videos')
assert c.channel_name == | 'ProgrammingKnowledge' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_channel.py | test_init_with_url | assert | string_literal | 15 | from unittest import mock
from pytubefix import Channel
@mock.patch('pytubefix.request.get')
def test_init_with_url(request_get, channel_videos_html):
request_get.return_value = channel_videos_html
c = Channel('https://www.youtube.com/c/ProgrammingKnowledge/videos')
assert c.channel_url == 'https://www.yo... | f'{c.channel_url}/about' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_channel.py | test_init_with_url | assert | string_literal | 11 | from unittest import mock
from pytubefix import Channel
@mock.patch('pytubefix.request.get')
def test_init_with_url(request_get, channel_videos_html):
request_get.return_value = channel_videos_html
c = Channel('https://www.youtube.com/c/ProgrammingKnowledge/videos')
assert c.channel_url == 'https://www.yo... | f'{c.channel_url}/videos' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_channel.py | test_channel_uri | assert | string_literal | 11 | from unittest import mock
from pytubefix import Channel
@mock.patch('pytubefix.request.get')
def test_channel_uri(request_get, channel_videos_html):
request_get.return_value = channel_videos_html
c = Channel('https://www.youtube.com/c/ProgrammingKnowledge/videos')
assert c.channel_uri == | '/c/ProgrammingKnowledge' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_channel.py | test_channel_id | assert | string_literal | 11 | from unittest import mock
from pytubefix import Channel
@mock.patch('pytubefix.request.get')
def test_channel_id(request_get, channel_videos_html):
request_get.return_value = channel_videos_html
c = Channel('https://www.youtube.com/c/ProgrammingKnowledge/videos')
assert c.channel_id == | 'UCs6nmQViDpUw0nuIx9c_WvA' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_channel.py | test_init_with_url | assert | string_literal | 14 | from unittest import mock
from pytubefix import Channel
@mock.patch('pytubefix.request.get')
def test_init_with_url(request_get, channel_videos_html):
request_get.return_value = channel_videos_html
c = Channel('https://www.youtube.com/c/ProgrammingKnowledge/videos')
assert c.channel_url == 'https://www.yo... | f'{c.channel_url}/channels' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_channel.py | test_init_with_url | assert | string_literal | 12 | from unittest import mock
from pytubefix import Channel
@mock.patch('pytubefix.request.get')
def test_init_with_url(request_get, channel_videos_html):
request_get.return_value = channel_videos_html
c = Channel('https://www.youtube.com/c/ProgrammingKnowledge/videos')
assert c.channel_url == 'https://www.yo... | f'{c.channel_url}/playlists' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_channel.py | test_init_with_url | assert | string_literal | 13 | from unittest import mock
from pytubefix import Channel
@mock.patch('pytubefix.request.get')
def test_init_with_url(request_get, channel_videos_html):
request_get.return_value = channel_videos_html
c = Channel('https://www.youtube.com/c/ProgrammingKnowledge/videos')
assert c.channel_url == 'https://www.yo... | f'{c.channel_url}/community' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_channel.py | test_channel_uri | assert | string_literal | 14 | from unittest import mock
from pytubefix import Channel
@mock.patch('pytubefix.request.get')
def test_channel_uri(request_get, channel_videos_html):
request_get.return_value = channel_videos_html
c = Channel('https://www.youtube.com/c/ProgrammingKnowledge/videos')
assert c.channel_uri == '/c/ProgrammingK... | '/channel/UCs6nmQViDpUw0nuIx9c_WvA' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_channel.py | test_channel_vanity_url | assert | string_literal | 11 | from unittest import mock
from pytubefix import Channel
@mock.patch('pytubefix.request.get')
def test_channel_vanity_url(request_get, channel_videos_html):
request_get.return_value = channel_videos_html
c = Channel('https://www.youtube.com/c/ProgrammingKnowledge/videos')
assert c.vanity_url == | 'http://www.youtube.com/c/ProgrammingKnowledge' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_playlist.py | test_trimmed | assert | numeric_literal | 17 | import datetime
from unittest import mock
from pytubefix import Playlist
@mock.patch("pytubefix.request.get")
def test_trimmed(request_get, playlist_html):
url = "https://www.fakeurl.com/playlist?list=whatever"
request_get.return_value = playlist_html
playlist = Playlist(url)
trimmed = list(playlist.t... | 1 | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_playlist.py | test_trimmed_pagination | assert | numeric_literal | 19 | import datetime
from unittest import mock
from pytubefix import Playlist
@mock.patch("pytubefix.request.get")
def test_trimmed_pagination(request_get, playlist_html, playlist_long_html):
url = "https://www.fakeurl.com/playlist?list=whatever"
request_get.side_effect = [
playlist_long_html,
'{"c... | 3 | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_playlist.py | test_sequence | assert | numeric_literal | 13 | import datetime
from unittest import mock
from pytubefix import Playlist
@mock.patch("pytubefix.request.get")
def test_sequence(request_get, playlist_html):
url = "https://www.fakeurl.com/playlist?list=whatever"
request_get.return_value = playlist_html
playlist = Playlist(url)
assert playlist[0] == "h... | 12 | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_playlist.py | test_init_with_playlist_url | assert | variable | 15 | import datetime
from unittest import mock
from pytubefix import Playlist
@mock.patch("pytubefix.request.get")
def test_init_with_playlist_url(request_get):
request_get.return_value = ""
url = (
"https://www.youtube.com/playlist?list=PLS1QulWo1RIaJECMeUT4LFwJ"
"-ghgoSH6n"
)
playlist = P... | url | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_playlist.py | test_playlist_failed_pagination | assert | numeric_literal | 19 | import datetime
from unittest import mock
from pytubefix import Playlist
@mock.patch("pytubefix.request.get")
@mock.patch("pytubefix.request.post")
def test_playlist_failed_pagination(request_post, request_get, playlist_long_html):
url = "https://www.fakeurl.com/playlist?list=whatever"
request_get.side_effect... | 100 | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_playlist.py | test_playlist_length | assert | numeric_literal | 12 | import datetime
from unittest import mock
from pytubefix import Playlist
@mock.patch("pytubefix.request.get")
def test_playlist_length(request_get, playlist_long_html):
url = 'https://www.example.com/playlist?list=whatever'
request_get.return_value = playlist_long_html
p = Playlist(url)
assert p.leng... | 217 | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_playlist.py | test_playlist_views | assert | numeric_literal | 12 | import datetime
from unittest import mock
from pytubefix import Playlist
@mock.patch("pytubefix.request.get")
def test_playlist_views(request_get, playlist_long_html):
url = 'https://www.example.com/playlist?list=whatever'
request_get.return_value = playlist_long_html
p = Playlist(url)
assert p.views... | 4617130 | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_playlist.py | test_last_updated | assert | variable | 15 | import datetime
from unittest import mock
from pytubefix import Playlist
@mock.patch("pytubefix.request.get")
def test_last_updated(request_get, playlist_long_html):
expected = datetime.date(2020, 10, 8)
request_get.return_value = playlist_long_html
playlist = Playlist(
"https://www.youtube.com/pl... | expected | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_playlist.py | test_html | assert | variable | 12 | import datetime
from unittest import mock
from pytubefix import Playlist
@mock.patch("pytubefix.request.get")
def test_html(request_get, playlist_html):
url = "https://www.fakeurl.com/playlist?list=whatever"
request_get.return_value = playlist_html
playlist = Playlist(url)
assert playlist.html == | playlist_html | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_playlist.py | test_proxy | assert_* | collection | 13 | import datetime
from unittest import mock
from pytubefix import Playlist
@mock.patch("pytubefix.request.get")
@mock.patch("pytubefix.contrib.playlist.install_proxy", return_value=None)
def test_proxy(install_proxy, request_get):
url = "https://www.fakeurl.com/playlist?list=whatever"
request_get.return_value =... | {"http": "things"}) | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/contrib/test_playlist.py | test_playlist_owner | assert | string_literal | 12 | import datetime
from unittest import mock
from pytubefix import Playlist
@mock.patch("pytubefix.request.get")
def test_playlist_owner(request_get, playlist_long_html):
url = 'https://www.example.com/playlist?list=whatever'
request_get.return_value = playlist_long_html
p = Playlist(url)
assert p.owner... | 'ProgrammingKnowledge' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_captions.py | test_caption_query_sequence | assert | numeric_literal | 17 | import os
import pytest
from unittest import mock
from unittest.mock import MagicMock, mock_open, patch
from pytubefix import Caption, CaptionQuery, captions
def test_caption_query_sequence():
caption1 = Caption(
{"url": "url1", "name": {"simpleText": "name1"}, "languageCode": "en", "vssId": ".en"}
)
... | 2 | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_captions.py | test_caption_query_sequence | assert | none_literal | 21 | import os
import pytest
from unittest import mock
from unittest.mock import MagicMock, mock_open, patch
from pytubefix import Caption, CaptionQuery, captions
def test_caption_query_sequence():
caption1 = Caption(
{"url": "url1", "name": {"simpleText": "name1"}, "languageCode": "en", "vssId": ".en"}
)
... | None | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_captions.py | test_xml_captions | assert | string_literal | 15 | import os
import pytest
from unittest import mock
from unittest.mock import MagicMock, mock_open, patch
from pytubefix import Caption, CaptionQuery, captions
@mock.patch("pytubefix.request.get")
def test_xml_captions(request_get):
request_get.return_value = "test"
caption = Caption(
{"url": "url1", "n... | "test" | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_captions.py | test_download_with_output_path | assert_* | string_literal | 25 | import os
import pytest
from unittest import mock
from unittest.mock import MagicMock, mock_open, patch
from pytubefix import Caption, CaptionQuery, captions
@mock.patch("pytubefix.captions.Caption.generate_srt_captions")
def test_download_with_output_path(srt):
open_mock = mock_open()
captions.target_directo... | "blah") | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_captions.py | test_caption_query_sequence | assert | variable | 18 | import os
import pytest
from unittest import mock
from unittest.mock import MagicMock, mock_open, patch
from pytubefix import Caption, CaptionQuery, captions
def test_caption_query_sequence():
caption1 = Caption(
{"url": "url1", "name": {"simpleText": "name1"}, "languageCode": "en", "vssId": ".en"}
)
... | caption1 | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_captions.py | test_caption_query_sequence | assert | variable | 19 | import os
import pytest
from unittest import mock
from unittest.mock import MagicMock, mock_open, patch
from pytubefix import Caption, CaptionQuery, captions
def test_caption_query_sequence():
caption1 = Caption(
{"url": "url1", "name": {"simpleText": "name1"}, "languageCode": "en", "vssId": ".en"}
)
... | caption2 | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_captions.py | test_caption_query_sequence | pytest.raises | variable | 20 | import os
import pytest
from unittest import mock
from unittest.mock import MagicMock, mock_open, patch
from pytubefix import Caption, CaptionQuery, captions
def test_caption_query_sequence():
caption1 = Caption(
{"url": "url1", "name": {"simpleText": "name1"}, "languageCode": "en", "vssId": ".en"}
)
... | KeyError) | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_captions.py | test_float_to_srt_time_format | assert | string_literal | 13 | import os
import pytest
from unittest import mock
from unittest.mock import MagicMock, mock_open, patch
from pytubefix import Caption, CaptionQuery, captions
def test_float_to_srt_time_format():
caption1 = Caption(
{"url": "url1", "name": {"simpleText": "name1"}, "languageCode": "en", "vssId": ".en"}
... | "00:00:03,890" | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_captions.py | test_download | assert | string_literal | 23 | import os
import pytest
from unittest import mock
from unittest.mock import MagicMock, mock_open, patch
from pytubefix import Caption, CaptionQuery, captions
@mock.patch("pytubefix.captions.Caption.generate_srt_captions")
def test_download(srt):
open_mock = mock_open()
with patch("builtins.open", open_mock):
... | "title (en).srt" | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_captions.py | test_download_xml_and_trim_extension | assert | string_literal | 23 | import os
import pytest
from unittest import mock
from unittest.mock import MagicMock, mock_open, patch
from pytubefix import Caption, CaptionQuery, captions
@mock.patch("pytubefix.captions.Caption.xml_captions")
def test_download_xml_and_trim_extension(xml):
open_mock = mock_open()
with patch("builtins.open"... | "title (en).xml" | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_captions.py | test_download_with_prefix | assert | string_literal | 23 | import os
import pytest
from unittest import mock
from unittest.mock import MagicMock, mock_open, patch
from pytubefix import Caption, CaptionQuery, captions
@mock.patch("pytubefix.captions.Caption.generate_srt_captions")
def test_download_with_prefix(srt):
open_mock = mock_open()
with patch("builtins.open", ... | "1 title (en).srt" | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_captions.py | test_generate_srt_captions | assert | func_call | 71 | import os
import pytest
from unittest import mock
from unittest.mock import MagicMock, mock_open, patch
from pytubefix import Caption, CaptionQuery, captions
@mock.patch("pytubefix.captions.request")
def test_generate_srt_captions(request):
clean_text = lambda x: x.replace(' ', '').replace('\n', '')
xml_dat... | clean_text(expected_output) | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_captions.py | test_repr | assert | string_literal | 13 | import os
import pytest
from unittest import mock
from unittest.mock import MagicMock, mock_open, patch
from pytubefix import Caption, CaptionQuery, captions
def test_repr():
caption = Caption(
{"url": "url1", "name": {"simpleText": "name1"}, "languageCode": "en", "vssId": ".en"}
)
assert str(cap... | '<Caption lang="name1" code="en">' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_captions.py | test_download_with_output_path | assert | func_call | 24 | import os
import pytest
from unittest import mock
from unittest.mock import MagicMock, mock_open, patch
from pytubefix import Caption, CaptionQuery, captions
@mock.patch("pytubefix.captions.Caption.generate_srt_captions")
def test_download_with_output_path(srt):
open_mock = mock_open()
captions.target_directo... | os.path.join("/target","title (en).srt") | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_captions.py | test_repr | assert | string_literal | 16 | import os
import pytest
from unittest import mock
from unittest.mock import MagicMock, mock_open, patch
from pytubefix import Caption, CaptionQuery, captions
def test_repr():
caption = Caption(
{"url": "url1", "name": {"simpleText": "name1"}, "languageCode": "en", "vssId": ".en"}
)
assert str(capt... | '{\'en\': <Caption lang="name1" code="en">}' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cipher.py | test_splice | assert | collection | 8 | import pytest
from pytubefix import cipher
from pytubefix.exceptions import RegexMatchError
def test_splice():
assert cipher.splice([1, 2, 3, 4], 2) == | [3, 4] | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cipher.py | test_js_splice | assert | variable | 13 | import pytest
from pytubefix import cipher
from pytubefix.exceptions import RegexMatchError
def test_js_splice():
mapping = {
}
for args, result in mapping.items():
a = [1, 2, 3, 4]
assert cipher.js_splice(a, *args) == | result | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cipher.py | test_splice | assert | collection | 9 | import pytest
from pytubefix import cipher
from pytubefix.exceptions import RegexMatchError
def test_splice():
assert cipher.splice([1, 2, 3, 4], 2) == [3, 4]
assert cipher.splice([1, 2, 3, 4], 1) == | [2, 3, 4] | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cipher.py | test_reverse | assert | collection | 9 | import pytest
from pytubefix import cipher
from pytubefix.exceptions import RegexMatchError
def test_reverse():
reversed_array = cipher.reverse([1, 2, 3, 4], None)
assert reversed_array == | [4, 3, 2, 1] | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cipher.py | test_throttling_unshift | assert | collection | 10 | import pytest
from pytubefix import cipher
from pytubefix.exceptions import RegexMatchError
def test_throttling_unshift():
a = [1, 2, 3, 4]
cipher.throttling_unshift(a, 2)
assert a == | [3, 4, 1, 2] | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cipher.py | test_throttling_nested_splice | assert | collection | 10 | import pytest
from pytubefix import cipher
from pytubefix.exceptions import RegexMatchError
def test_throttling_nested_splice():
a = [1, 2, 3, 4]
cipher.throttling_nested_splice(a, 2)
assert a == | [3, 2, 1, 4] | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cipher.py | test_throttling_prepend | assert | collection | 10 | import pytest
from pytubefix import cipher
from pytubefix.exceptions import RegexMatchError
def test_throttling_prepend():
a = [1, 2, 3, 4]
cipher.throttling_prepend(a, 1)
assert a == | [4, 1, 2, 3] | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cipher.py | test_throttling_swap | assert | collection | 10 | import pytest
from pytubefix import cipher
from pytubefix.exceptions import RegexMatchError
def test_throttling_swap():
a = [1, 2, 3, 4]
cipher.throttling_swap(a, 3)
assert a == | [4, 2, 3, 1] | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cipher.py | test_get_throttling_function_name | assert | variable | 25 | import pytest
from pytubefix import cipher
from pytubefix.exceptions import RegexMatchError
def test_get_throttling_function_name(base_js):
base_js_code_fragments = [
# Values expected as of 2022/02/04:
{
'raw_var' : r'var Apa=[hha]',
'raw_code': r'a.url="";a.C&&(b=a.get("n... | base_js_file | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cipher.py | test_throttling_push | assert | collection | 10 | import pytest
from pytubefix import cipher
from pytubefix.exceptions import RegexMatchError
def test_throttling_push():
a = [1, 2, 3, 4]
cipher.throttling_push(a, 5)
assert a == | [1, 2, 3, 4, 5] | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cipher.py | test_map_functions | pytest.raises | variable | 8 | import pytest
from pytubefix import cipher
from pytubefix.exceptions import RegexMatchError
def test_map_functions():
with pytest.raises( | RegexMatchError) | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cipher.py | test_get_throttling_function_name | assert | complex_expr | 28 | import pytest
from pytubefix import cipher
from pytubefix.exceptions import RegexMatchError
def test_get_throttling_function_name(base_js):
base_js_code_fragments = [
# Values expected as of 2022/02/04:
{
'raw_var' : r'var Apa=[hha]',
'raw_code': r'a.url="";a.C&&(b=a.get("n... | code_fragment['nfunc_name'] | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cli.py | test_parse_args_truthy | assert | numeric_literal | 32 | import argparse
import logging
import os
from unittest import mock
from unittest.mock import MagicMock, patch
import pytest
from pytubefix import Caption, CaptionQuery, cli, StreamQuery
from pytubefix.exceptions import PytubeFixError
from urllib.error import HTTPError
parse_args = cli._parse_args
def test_parse_arg... | 10 | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cli.py | test_display_progress_bar | assert | variable | 19 | import argparse
import logging
import os
from unittest import mock
from unittest.mock import MagicMock, patch
import pytest
from pytubefix import Caption, CaptionQuery, cli, StreamQuery
from pytubefix.exceptions import PytubeFixError
from urllib.error import HTTPError
parse_args = cli._parse_args
def test_display_p... | out | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cli.py | test_on_progress | assert_* | numeric_literal | 21 | import argparse
import logging
import os
from unittest import mock
from unittest.mock import MagicMock, patch
import pytest
from pytubefix import Caption, CaptionQuery, cli, StreamQuery
from pytubefix.exceptions import PytubeFixError
from urllib.error import HTTPError
parse_args = cli._parse_args
@mock.patch("pytub... | 10) | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cli.py | test_parse_args_falsey | assert | none_literal | 21 | import argparse
import logging
import os
from unittest import mock
from unittest.mock import MagicMock, patch
import pytest
from pytubefix import Caption, CaptionQuery, cli, StreamQuery
from pytubefix.exceptions import PytubeFixError
from urllib.error import HTTPError
parse_args = cli._parse_args
def test_parse_arg... | None | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cli.py | test_parse_args_truthy | assert | bool_literal | 31 | import argparse
import logging
import os
from unittest import mock
from unittest.mock import MagicMock, patch
import pytest
from pytubefix import Caption, CaptionQuery, cli, StreamQuery
from pytubefix.exceptions import PytubeFixError
from urllib.error import HTTPError
parse_args = cli._parse_args
def test_parse_arg... | True | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cli.py | test_download_when_itag_not_found | assert_* | numeric_literal | 26 | import argparse
import logging
import os
from unittest import mock
from unittest.mock import MagicMock, patch
import pytest
from pytubefix import Caption, CaptionQuery, cli, StreamQuery
from pytubefix.exceptions import PytubeFixError
from urllib.error import HTTPError
parse_args = cli._parse_args
@mock.patch("pytub... | 123) | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cli.py | test_parse_args_falsey | assert | bool_literal | 20 | import argparse
import logging
import os
from unittest import mock
from unittest.mock import MagicMock, patch
import pytest
from pytubefix import Caption, CaptionQuery, cli, StreamQuery
from pytubefix.exceptions import PytubeFixError
from urllib.error import HTTPError
parse_args = cli._parse_args
def test_parse_arg... | False | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cli.py | test_download_with_playlist | assert_* | variable | 35 | import argparse
import logging
import os
from unittest import mock
from unittest.mock import MagicMock, patch
import pytest
from pytubefix import Caption, CaptionQuery, cli, StreamQuery
from pytubefix.exceptions import PytubeFixError
from urllib.error import HTTPError
parse_args = cli._parse_args
@mock.patch("pytub... | args) | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cli.py | test_download_by_resolution | assert_* | variable | 29 | import argparse
import logging
import os
from unittest import mock
from unittest.mock import MagicMock, patch
import pytest
from pytubefix import Caption, CaptionQuery, cli, StreamQuery
from pytubefix.exceptions import PytubeFixError
from urllib.error import HTTPError
parse_args = cli._parse_args
@mock.patch("pytub... | stream) | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cli.py | test_download_when_itag_not_found | assert_* | variable | 27 | import argparse
import logging
import os
from unittest import mock
from unittest.mock import MagicMock, patch
import pytest
from pytubefix import Caption, CaptionQuery, cli, StreamQuery
from pytubefix.exceptions import PytubeFixError
from urllib.error import HTTPError
parse_args = cli._parse_args
@mock.patch("pytub... | youtube) | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_cli.py | test_download_when_itag_not_found | pytest.raises | variable | 23 | import argparse
import logging
import os
from unittest import mock
from unittest.mock import MagicMock, patch
import pytest
from pytubefix import Caption, CaptionQuery, cli, StreamQuery
from pytubefix.exceptions import PytubeFixError
from urllib.error import HTTPError
parse_args = cli._parse_args
@mock.patch("pytub... | SystemExit) | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_exceptions.py | test_video_unavailable | assert | string_literal | 13 | import pytest
from unittest import mock
import pytubefix.exceptions as exceptions
from pytubefix import YouTube
from pytubefix.helpers import strip_color_codes
def test_video_unavailable():
try:
raise exceptions.VideoUnavailable(video_id="YLnZklYFe7E")
except exceptions.VideoUnavailable as e:
... | "YLnZklYFe7E" | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_exceptions.py | test_live_stream_error | assert | string_literal | 16 | import pytest
from unittest import mock
import pytubefix.exceptions as exceptions
from pytubefix import YouTube
from pytubefix.helpers import strip_color_codes
def test_live_stream_error():
# Ensure this can be caught as generic VideoUnavailable exception
with pytest.raises(exceptions.VideoUnavailable):
... | 'YLnZklYFe7E' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_exceptions.py | test_recording_unavailable_error | assert | string_literal | 16 | import pytest
from unittest import mock
import pytubefix.exceptions as exceptions
from pytubefix import YouTube
from pytubefix.helpers import strip_color_codes
def test_recording_unavailable_error():
# Ensure this can be caught as generic VideoUnavailable exception
with pytest.raises(exceptions.VideoUnavailab... | '5YceQ8YqYMc' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_exceptions.py | test_private_error | assert | string_literal | 16 | import pytest
from unittest import mock
import pytubefix.exceptions as exceptions
from pytubefix import YouTube
from pytubefix.helpers import strip_color_codes
def test_private_error():
# Ensure this can be caught as generic VideoUnavailable exception
with pytest.raises(exceptions.VideoUnavailable):
r... | 'm8uHb5jIGN8' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_exceptions.py | test_region_locked_error | assert | string_literal | 16 | import pytest
from unittest import mock
import pytubefix.exceptions as exceptions
from pytubefix import YouTube
from pytubefix.helpers import strip_color_codes
def test_region_locked_error():
# Ensure this can be caught as generic VideoUnavailable exception
with pytest.raises(exceptions.VideoUnavailable):
... | 'hZpzr8TbF08' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_exceptions.py | test_raises_video_private | pytest.raises | complex_expr | 17 | import pytest
from unittest import mock
import pytubefix.exceptions as exceptions
from pytubefix import YouTube
from pytubefix.helpers import strip_color_codes
def test_raises_video_private(private):
with mock.patch('pytubefix.request.urlopen') as mock_url_open:
# Mock the responses to YouTube
moc... | exceptions.VideoPrivate) | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_exceptions.py | test_video_unavailable | assert | string_literal | 14 | import pytest
from unittest import mock
import pytubefix.exceptions as exceptions
from pytubefix import YouTube
from pytubefix.helpers import strip_color_codes
def test_video_unavailable():
try:
raise exceptions.VideoUnavailable(video_id="YLnZklYFe7E")
except exceptions.VideoUnavailable as e:
... | "YLnZklYFe7E is unavailable" | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_exceptions.py | test_live_stream_error | pytest.raises | complex_expr | 11 | import pytest
from unittest import mock
import pytubefix.exceptions as exceptions
from pytubefix import YouTube
from pytubefix.helpers import strip_color_codes
def test_live_stream_error():
# Ensure this can be caught as generic VideoUnavailable exception
with pytest.raises( | exceptions.VideoUnavailable) | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_exceptions.py | test_private_error | assert | string_literal | 17 | import pytest
from unittest import mock
import pytubefix.exceptions as exceptions
from pytubefix import YouTube
from pytubefix.helpers import strip_color_codes
def test_private_error():
# Ensure this can be caught as generic VideoUnavailable exception
with pytest.raises(exceptions.VideoUnavailable):
r... | 'm8uHb5jIGN8 is a private video' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_exceptions.py | test_raises_recording_unavailable | pytest.raises | complex_expr | 17 | import pytest
from unittest import mock
import pytubefix.exceptions as exceptions
from pytubefix import YouTube
from pytubefix.helpers import strip_color_codes
def test_raises_recording_unavailable(missing_recording):
with mock.patch('pytubefix.request.urlopen') as mock_url_open:
# Mock the responses to Y... | exceptions.RecordingUnavailable) | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_exceptions.py | test_regex_match_error | assert | string_literal | 13 | import pytest
from unittest import mock
import pytubefix.exceptions as exceptions
from pytubefix import YouTube
from pytubefix.helpers import strip_color_codes
def test_regex_match_error():
try:
raise exceptions.RegexMatchError(caller="hello", pattern="*")
except exceptions.RegexMatchError as e:
... | "hello: could not find match for *" | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_exceptions.py | test_region_locked_error | assert | string_literal | 17 | import pytest
from unittest import mock
import pytubefix.exceptions as exceptions
from pytubefix import YouTube
from pytubefix.helpers import strip_color_codes
def test_region_locked_error():
# Ensure this can be caught as generic VideoUnavailable exception
with pytest.raises(exceptions.VideoUnavailable):
... | 'hZpzr8TbF08 is not available in your region' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_exceptions.py | test_live_stream_error | assert | string_literal | 17 | import pytest
from unittest import mock
import pytubefix.exceptions as exceptions
from pytubefix import YouTube
from pytubefix.helpers import strip_color_codes
def test_live_stream_error():
# Ensure this can be caught as generic VideoUnavailable exception
with pytest.raises(exceptions.VideoUnavailable):
... | 'YLnZklYFe7E is streaming live and cannot be loaded' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_exceptions.py | test_recording_unavailable_error | assert | string_literal | 17 | import pytest
from unittest import mock
import pytubefix.exceptions as exceptions
from pytubefix import YouTube
from pytubefix.helpers import strip_color_codes
def test_recording_unavailable_error():
# Ensure this can be caught as generic VideoUnavailable exception
with pytest.raises(exceptions.VideoUnavailab... | '5YceQ8YqYMc does not have a live stream recording available' | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_extract.py | test_js_url | assert | none_literal | 15 | from datetime import datetime
import pytest
import re
from pytubefix import extract
from pytubefix.exceptions import RegexMatchError
def test_js_url(cipher_signature):
expected = (
r"https://youtube.com/s/player/([\w\d]+)/player_ias.vflset/en_US/base.js"
)
result = extract.js_url(cipher_signature.... | None | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_extract.py | test_publish_date | assert | variable | 11 | from datetime import datetime
import pytest
import re
from pytubefix import extract
from pytubefix.exceptions import RegexMatchError
def test_publish_date(cipher_signature):
expected = datetime(2019, 12, 5)
assert cipher_signature.publish_date == | expected | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_extract.py | test_mime_type_codec | assert | collection | 14 | from datetime import datetime
import pytest
import re
from pytubefix import extract
from pytubefix.exceptions import RegexMatchError
def test_mime_type_codec():
mime_type, mime_subtype = extract.mime_type_codec(
'audio/webm; codecs="opus"'
)
assert mime_type == "audio/webm"
assert mime_subtyp... | ["opus"] | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_extract.py | test_mime_type_codec | assert | string_literal | 13 | from datetime import datetime
import pytest
import re
from pytubefix import extract
from pytubefix.exceptions import RegexMatchError
def test_mime_type_codec():
mime_type, mime_subtype = extract.mime_type_codec(
'audio/webm; codecs="opus"'
)
assert mime_type == | "audio/webm" | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_extract.py | test_initial_data | assert | variable | 11 | from datetime import datetime
import pytest
import re
from pytubefix import extract
from pytubefix.exceptions import RegexMatchError
def test_initial_data(stream_dict):
initial_data = extract.initial_data(stream_dict)
assert 'contents' in | initial_data | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_extract.py | test_extract_video_id | assert | string_literal | 12 | from datetime import datetime
import pytest
import re
from pytubefix import extract
from pytubefix.exceptions import RegexMatchError
def test_extract_video_id():
url = "https://www.youtube.com/watch?v=2lAe1cqCOXo"
video_id = extract.video_id(url)
assert video_id == | "2lAe1cqCOXo" | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_extract.py | test_info_url | assert | variable | 14 | from datetime import datetime
import pytest
import re
from pytubefix import extract
from pytubefix.exceptions import RegexMatchError
def test_info_url(age_restricted):
video_info_url = extract.video_info_url_age_restricted(
video_id="QRS8MkLhQmM", embed_html=age_restricted["embed_html"],
)
assert ... | video_info_url | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_extract.py | test_mime_type_codec_with_no_match_should_error | pytest.raises | variable | 10 | from datetime import datetime
import pytest
import re
from pytubefix import extract
from pytubefix.exceptions import RegexMatchError
def test_mime_type_codec_with_no_match_should_error():
with pytest.raises( | RegexMatchError) | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_helpers.py | test_cache | assert | numeric_literal | 28 | import gzip
import io
import json
import os
import pytest
from unittest import mock
from pytubefix import helpers
from pytubefix.exceptions import RegexMatchError
from pytubefix.helpers import cache, create_mock_html_json, deprecated, setup_logger
from pytubefix.helpers import target_directory, uniqueify
def test_cac... | 2 | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_helpers.py | test_regex_search | assert | string_literal | 15 | import gzip
import io
import json
import os
import pytest
from unittest import mock
from pytubefix import helpers
from pytubefix.exceptions import RegexMatchError
from pytubefix.helpers import cache, create_mock_html_json, deprecated, setup_logger
from pytubefix.helpers import target_directory, uniqueify
def test_reg... | "a" | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_helpers.py | test_setup_logger | assert_* | numeric_literal | 23 | import gzip
import io
import json
import os
import pytest
from unittest import mock
from pytubefix import helpers
from pytubefix.exceptions import RegexMatchError
from pytubefix.helpers import cache, create_mock_html_json, deprecated, setup_logger
from pytubefix.helpers import target_directory, uniqueify
@mock.patch(... | 20) | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_helpers.py | test_safe_filename | assert | string_literal | 17 | import gzip
import io
import json
import os
import pytest
from unittest import mock
from pytubefix import helpers
from pytubefix.exceptions import RegexMatchError
from pytubefix.helpers import cache, create_mock_html_json, deprecated, setup_logger
from pytubefix.helpers import target_directory, uniqueify
def test_saf... | "abc" | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_helpers.py | test_create_mock_html_json | assert_* | string_literal | 51 | import gzip
import io
import json
import os
import pytest
from unittest import mock
from pytubefix import helpers
from pytubefix.exceptions import RegexMatchError
from pytubefix.helpers import cache, create_mock_html_json, deprecated, setup_logger
from pytubefix.helpers import target_directory, uniqueify
@mock.patch(... | 'wb') | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
JuanBindez/pytubefix | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | train | train | tests/test_helpers.py | test_target_directory_with_no_path | assert | string_literal | 17 | import gzip
import io
import json
import os
import pytest
from unittest import mock
from pytubefix import helpers
from pytubefix.exceptions import RegexMatchError
from pytubefix.helpers import cache, create_mock_html_json, deprecated, setup_logger
from pytubefix.helpers import target_directory, uniqueify
@mock.patch(... | "/cwd" | aaced154b8a6b846f2891ce0aedcf8a59ccec668 | 7 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.