repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
uriyyo/fastapi-pagination | from typing import ClassVar, Generic, TypeVar
import pytest
from fastapi import FastAPI, Query, status
from fastapi_pagination import Page, Params, add_pagination, paginate
from fastapi_pagination.bases import AbstractPage, AbstractParams
from fastapi_pagination.cursor import CursorPage, encode_cursor
from fastapi_pa... | True | assert | bool_literal | tests/test_customization.py | test_custom_customizer | 307 | null | |
uriyyo/fastapi-pagination | from fastapi_pagination.ext.utils import get_mongo_pipeline_filter_end, len_or_none, unwrap_scalars, wrap_scalars
def test_get_mongo_pipeline_filter_end():
assert get_mongo_pipeline_filter_end([]) == 0
assert get_mongo_pipeline_filter_end([{"$match": {}}]) == 1
assert get_mongo_pipeline_filter_end([{"$matc... | 2 | assert | numeric_literal | tests/ext/test_utils.py | test_get_mongo_pipeline_filter_end | 29 | null | |
uriyyo/fastapi-pagination | import pytest
from dirty_equals import IsStr
from fastapi import FastAPI, status
from starlette.testclient import TestClient
from fastapi_pagination import LimitOffsetPage, Page, add_pagination
from fastapi_pagination.links import LimitOffsetPage as LinksLimitOffsetPage
from fastapi_pagination.links import Page as Lin... | status.HTTP_200_OK | assert | complex_expr | tests/test_openapi.py | test_openapi_schema | 134 | null | |
uriyyo/fastapi-pagination | from typing import Any
import pytest
from fastapi import Depends, FastAPI, status
from fastapi.testclient import TestClient
from pydantic import BaseModel
from fastapi_pagination import add_pagination, paginate, pagination_ctx
from fastapi_pagination.customization import CustomizedPage
from fastapi_pagination.links i... | status.HTTP_200_OK | assert | complex_expr | tests/test_links.py | test_links | 140 | null | |
uriyyo/fastapi-pagination | from typing import Generic, TypeVar
import pytest
from fastapi import Query
from fastapi_pagination import Page, Params
from fastapi_pagination.bases import AbstractPage, AbstractParams, BaseRawParams, RawParams
from fastapi_pagination.cursor import CursorParams
T = TypeVar("T")
C = TypeVar("C")
def test_page_type_... | None | assert | none_literal | tests/test_bases.py | test_page_type_is_not_reinited | 61 | null | |
uriyyo/fastapi-pagination | import pytest
from fastapi_pagination import (
Page,
Params,
paginate,
set_page,
)
from fastapi_pagination.api import set_items_transformer
from fastapi_pagination.customization import CustomizedPage, UseAdditionalFields
from .base import BasePaginationTestSuite
def test_explicit_params():
page =... | Page(items=[], total=0, page=2, pages=0, size=10) | assert | func_call | tests/test_paginator.py | test_explicit_params | 43 | null | |
uriyyo/fastapi-pagination | from typing import Any
import pytest
from fastapi import Depends, FastAPI, status
from fastapi.testclient import TestClient
from pydantic import BaseModel
from fastapi_pagination import add_pagination, paginate, pagination_ctx
from fastapi_pagination.customization import CustomizedPage
from fastapi_pagination.links i... | ", ".join(parts) | assert | string_literal | tests/test_links.py | test_header_links | 236 | null | |
uriyyo/fastapi-pagination | import pytest
from fastapi_pagination import (
Page,
Params,
paginate,
set_page,
)
from fastapi_pagination.api import set_items_transformer
from fastapi_pagination.customization import CustomizedPage, UseAdditionalFields
from .base import BasePaginationTestSuite
def test_explicit_items_transformer():... | Page(items=[2, 4, 6], total=3, page=1, pages=1, size=50) | assert | func_call | tests/test_paginator.py | test_explicit_items_transformer | 52 | null | |
uriyyo/fastapi-pagination | from collections.abc import AsyncIterator, Sequence
from contextlib import asynccontextmanager
from typing import Annotated, Any, Generic, TypeVar
import pytest
from fastapi import Depends, FastAPI, Request, Response, status
from fastapi.routing import APIRouter
from fastapi.testclient import TestClient
from pydantic ... | Page | assert | variable | tests/test_api.py | test_page_resolve_from_params_val | 165 | null | |
uriyyo/fastapi-pagination | import pytest
from dirty_equals import IsStr
from fastapi import FastAPI, status
from starlette.testclient import TestClient
from fastapi_pagination import LimitOffsetPage, Page, add_pagination
from fastapi_pagination.links import LimitOffsetPage as LinksLimitOffsetPage
from fastapi_pagination.links import Page as Lin... | schema | assert | variable | tests/test_openapi.py | test_openapi_schema | 143 | null | |
uriyyo/fastapi-pagination | from collections.abc import AsyncIterator, Sequence
from contextlib import asynccontextmanager
from typing import Annotated, Any, Generic, TypeVar
import pytest
from fastapi import Depends, FastAPI, Request, Response, status
from fastapi.routing import APIRouter
from fastapi.testclient import TestClient
from pydantic ... | CustomPage | assert | variable | tests/test_api.py | test_page_resolve_set_page | 175 | null | |
uriyyo/fastapi-pagination | from typing import ClassVar, Generic, TypeVar
import pytest
from fastapi import FastAPI, Query, status
from fastapi_pagination import Page, Params, add_pagination, paginate
from fastapi_pagination.bases import AbstractPage, AbstractParams
from fastapi_pagination.cursor import CursorPage, encode_cursor
from fastapi_pa... | None | assert | none_literal | tests/test_customization.py | test_customize_use_optional_params | 263 | null | |
uriyyo/fastapi-pagination | from fastapi_pagination.ext.utils import get_mongo_pipeline_filter_end, len_or_none, unwrap_scalars, wrap_scalars
def test_len_or_none():
assert len_or_none(None) is None
assert len_or_none([]) == 0
assert len_or_none([1]) == | 1 | assert | numeric_literal | tests/ext/test_utils.py | test_len_or_none | 7 | null | |
uriyyo/fastapi-pagination | from contextlib import closing
from typing import Any
import pytest
from fastapi import Depends
from sqlalchemy import select, text
from sqlalchemy.orm import selectinload
from fastapi_pagination import Page, Params, set_page, set_params
from fastapi_pagination.cursor import CursorPage
from fastapi_pagination.customi... | [{"name": entry.name} for entry in entities[:10]] | assert | collection | tests/ext/test_sqlalchemy.py | test_scalar_not_unwrapped | TestSQLAlchemyUnwrap | 74 | null |
uriyyo/fastapi-pagination | import pytest
from fastapi import FastAPI, status
from fastapi.testclient import TestClient
from fastapi_pagination import Params, add_pagination, paginate, resolve_params
from fastapi_pagination.cursor import CursorPage, CursorParams
def test_unsupported_params():
with pytest.raises( | ValueError, match=r"^'cursor' params not supported$") | pytest.raises | complex_expr | tests/test_cursor.py | test_unsupported_params | 10 | null | |
uriyyo/fastapi-pagination | from collections.abc import AsyncIterator, Sequence
from contextlib import asynccontextmanager
from typing import Annotated, Any, Generic, TypeVar
import pytest
from fastapi import Depends, FastAPI, Request, Response, status
from fastapi.routing import APIRouter
from fastapi.testclient import TestClient
from pydantic ... | [2, 4, 6] | assert | collection | tests/test_api.py | test_async_items_transformer | 286 | null | |
uriyyo/fastapi-pagination | from typing import ClassVar, Generic, TypeVar
import pytest
from fastapi import FastAPI, Query, status
from fastapi_pagination import Page, Params, add_pagination, paginate
from fastapi_pagination.bases import AbstractPage, AbstractParams
from fastapi_pagination.cursor import CursorPage, encode_cursor
from fastapi_pa... | 20 | assert | numeric_literal | tests/test_customization.py | test_customization_use_params_fields | 121 | null | |
uriyyo/fastapi-pagination | from collections.abc import AsyncIterator, Sequence
from contextlib import asynccontextmanager
from typing import Annotated, Any, Generic, TypeVar
import pytest
from fastapi import Depends, FastAPI, Request, Response, status
from fastapi.routing import APIRouter
from fastapi.testclient import TestClient
from pydantic ... | 0 | assert | numeric_literal | tests/test_api.py | test_add_pagination | 82 | null | |
uriyyo/fastapi-pagination | from typing import Any
import pytest
from fastapi import Depends, FastAPI, status
from fastapi.testclient import TestClient
from pydantic import BaseModel
from fastapi_pagination import add_pagination, paginate, pagination_ctx
from fastapi_pagination.customization import CustomizedPage
from fastapi_pagination.links i... | None | assert | none_literal | tests/test_links.py | test_header_links | 235 | null | |
uriyyo/fastapi-pagination | import pytest
from fastapi import Depends, FastAPI
from fastapi.testclient import TestClient
from fastapi_pagination import LimitOffsetParams, Page, add_pagination
from fastapi_pagination.paginator import paginate
def test_default_page_with_limit_offset():
app = FastAPI()
client = TestClient(app)
@app.ge... | TypeError, match=r"Page should be used with Params") | pytest.raises | complex_expr | tests/test_invalid_usage.py | test_default_page_with_limit_offset | 30 | null | |
uriyyo/fastapi-pagination | from __future__ import annotations
from collections.abc import Iterable
from typing import ClassVar, TypeAlias
import pytest
from fastapi_pagination import LimitOffsetPage, LimitOffsetParams, Page, Params, paginate, set_page
from fastapi_pagination.bases import AbstractParams
from fastapi_pagination.cursor import Cu... | min(len(entities), size) | assert | func_call | tests/base/suite.py | run_cursor_pagination_test | BasePaginationTestSuite | 227 | null |
uriyyo/fastapi-pagination | from contextlib import closing
from typing import Any
import pytest
from fastapi import Depends
from sqlalchemy import select, text
from sqlalchemy.orm import selectinload
from fastapi_pagination import Page, Params, set_page, set_params
from fastapi_pagination.cursor import CursorPage
from fastapi_pagination.customi... | [{"id": entry.id, "name": entry.name} for entry in entities[:10]] | assert | collection | tests/ext/test_sqlalchemy.py | test_non_scalar_not_unwrapped | TestSQLAlchemyUnwrap | 80 | null |
uriyyo/fastapi-pagination | import pytest
from fastapi_pagination import utils
utils._EXTENSIONS = [
"unknown_extension",
"sqlalchemy",
]
def test_get_caller():
assert utils.get_caller(depth=1_000) is | None | assert | none_literal | tests/test_utils.py | test_get_caller | 26 | null | |
uriyyo/fastapi-pagination | from typing import Any
import pytest
from fastapi import Depends, FastAPI, status
from fastapi.testclient import TestClient
from pydantic import BaseModel
from fastapi_pagination import add_pagination, paginate, pagination_ctx
from fastapi_pagination.customization import CustomizedPage
from fastapi_pagination.links i... | { "page": { "items": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "total": 10, "limit": 50, "offset": 0, "links": { "first": "/revalidate/limit-offset?offset=0", "last": "/revalidate/limit-offset?offset=0", "self": "/revalidate/limit-offset", "next": None, "prev": None, }, }, } | assert | collection | tests/test_links.py | test_revalidation_limit_offset | 265 | null | |
uriyyo/fastapi-pagination | from collections.abc import AsyncIterator, Sequence
from contextlib import asynccontextmanager
from typing import Annotated, Any, Generic, TypeVar
import pytest
from fastapi import Depends, FastAPI, Request, Response, status
from fastapi.routing import APIRouter
from fastapi.testclient import TestClient
from pydantic ... | 1 | assert | numeric_literal | tests/test_api.py | test_add_pagination | 88 | null | |
uriyyo/fastapi-pagination | from fastapi_pagination.ext.utils import get_mongo_pipeline_filter_end, len_or_none, unwrap_scalars, wrap_scalars
def test_unwrap_scalars():
assert unwrap_scalars([]) == []
assert unwrap_scalars([[]]) == [[]]
assert unwrap_scalars([[1], [2]]) == | [1, 2] | assert | collection | tests/ext/test_utils.py | test_unwrap_scalars | 13 | null | |
uriyyo/fastapi-pagination | from __future__ import annotations
from collections.abc import Iterable
from typing import ClassVar, TypeAlias
import pytest
from fastapi_pagination import LimitOffsetPage, LimitOffsetParams, Page, Params, paginate, set_page
from fastapi_pagination.bases import AbstractParams
from fastapi_pagination.cursor import Cu... | expected.items | assert | complex_expr | tests/base/suite.py | run_cursor_pagination_test | BasePaginationTestSuite | 238 | null |
uriyyo/fastapi-pagination | from fastapi_pagination.ext.utils import get_mongo_pipeline_filter_end, len_or_none, unwrap_scalars, wrap_scalars
def test_get_mongo_pipeline_filter_end():
assert get_mongo_pipeline_filter_end([]) == 0
assert get_mongo_pipeline_filter_end([{"$match": {}}]) == 1
assert get_mongo_pipeline_filter_end([{"$matc... | 3 | assert | numeric_literal | tests/ext/test_utils.py | test_get_mongo_pipeline_filter_end | 30 | null | |
uriyyo/fastapi-pagination | from collections.abc import AsyncIterator, Sequence
from contextlib import asynccontextmanager
from typing import Annotated, Any, Generic, TypeVar
import pytest
from fastapi import Depends, FastAPI, Request, Response, status
from fastapi.routing import APIRouter
from fastapi.testclient import TestClient
from pydantic ... | CursorPage | assert | variable | tests/test_api.py | test_page_resolve_from_params_val | 167 | null | |
uriyyo/fastapi-pagination | from typing import Any
import pytest
from fastapi import Depends, FastAPI, status
from fastapi.testclient import TestClient
from pydantic import BaseModel
from fastapi_pagination import add_pagination, paginate, pagination_ctx
from fastapi_pagination.customization import CustomizedPage
from fastapi_pagination.links i... | { "self": self, "prev": prev, "next": next, "first": first, "last": last, } | assert | collection | tests/test_links.py | test_links | 141 | null | |
uriyyo/fastapi-pagination | from typing import ClassVar, Generic, TypeVar
import pytest
from fastapi import FastAPI, Query, status
from fastapi_pagination import Page, Params, add_pagination, paginate
from fastapi_pagination.bases import AbstractPage, AbstractParams
from fastapi_pagination.cursor import CursorPage, encode_cursor
from fastapi_pa... | 3 | assert | numeric_literal | tests/test_customization.py | test_use_pydantic_v1 | 472 | null | |
uriyyo/fastapi-pagination | from typing import Generic, TypeVar
import pytest
from fastapi import Query
from fastapi_pagination import Page, Params
from fastapi_pagination.bases import AbstractPage, AbstractParams, BaseRawParams, RawParams
from fastapi_pagination.cursor import CursorParams
T = TypeVar("T")
C = TypeVar("C")
def test_page_type_... | _Params | assert | variable | tests/test_bases.py | test_page_type_is_not_reinited | 66 | null | |
uriyyo/fastapi-pagination | from fastapi_pagination.ext.utils import get_mongo_pipeline_filter_end, len_or_none, unwrap_scalars, wrap_scalars
def test_unwrap_scalars():
assert unwrap_scalars([]) == | [] | assert | collection | tests/ext/test_utils.py | test_unwrap_scalars | 11 | null | |
uriyyo/fastapi-pagination | from collections.abc import AsyncIterator, Sequence
from contextlib import asynccontextmanager
from typing import Annotated, Any, Generic, TypeVar
import pytest
from fastapi import Depends, FastAPI, Request, Response, status
from fastapi.routing import APIRouter
from fastapi.testclient import TestClient
from pydantic ... | request() | assert | func_call | tests/test_api.py | route | 50 | null | |
uriyyo/fastapi-pagination | from typing import Generic, TypeVar
import pytest
from fastapi import Query
from fastapi_pagination import Page, Params
from fastapi_pagination.bases import AbstractPage, AbstractParams, BaseRawParams, RawParams
from fastapi_pagination.cursor import CursorParams
T = TypeVar("T")
C = TypeVar("C")
def test_invalid_pa... | ValueError, match=r"^Not a 'limit-offset' params$") | pytest.raises | complex_expr | tests/test_bases.py | test_invalid_params_cast | 39 | null | |
uriyyo/fastapi-pagination | import pytest
from fastapi import FastAPI, status
from fastapi.testclient import TestClient
from fastapi_pagination import Params, add_pagination, paginate, resolve_params
from fastapi_pagination.cursor import CursorPage, CursorParams
@pytest.mark.parametrize(
"cursor",
["invalid", "null"],
)
def test_invalid... | {"detail": "Invalid cursor value"} | assert | collection | tests/test_cursor.py | test_invalid_cursor | 46 | null | |
uriyyo/fastapi-pagination | import pytest
from fastapi import FastAPI, status
from fastapi.testclient import TestClient
from fastapi_pagination import Params, add_pagination, paginate, resolve_params
from fastapi_pagination.cursor import CursorPage, CursorParams
@pytest.mark.parametrize(
"cursor",
["invalid", "null"],
)
def test_invalid... | status.HTTP_400_BAD_REQUEST | assert | complex_expr | tests/test_cursor.py | test_invalid_cursor | 45 | null | |
uriyyo/fastapi-pagination | import pytest
from fastapi_pagination import (
Page,
Params,
paginate,
set_page,
)
from fastapi_pagination.api import set_items_transformer
from fastapi_pagination.customization import CustomizedPage, UseAdditionalFields
from .base import BasePaginationTestSuite
def test_paginator_additional_data():
... | CustomPage(items=[], total=0, page=1, pages=0, size=50, new_field=10) | assert | func_call | tests/test_paginator.py | test_paginator_additional_data | 37 | null | |
uriyyo/fastapi-pagination | from fastapi_pagination.ext.utils import get_mongo_pipeline_filter_end, len_or_none, unwrap_scalars, wrap_scalars
def test_unwrap_scalars():
assert unwrap_scalars([]) == []
assert unwrap_scalars([[]]) == [[]]
assert unwrap_scalars([[1], [2]]) == [1, 2]
assert unwrap_scalars([[1, 3], [2, 4]], force_unwr... | [1, [2, 3]] | assert | collection | tests/ext/test_utils.py | test_unwrap_scalars | 15 | null | |
uriyyo/fastapi-pagination | import pytest
from fastapi import Depends, FastAPI
from fastapi.testclient import TestClient
from fastapi_pagination import LimitOffsetParams, Page, add_pagination
from fastapi_pagination.paginator import paginate
def test_params_not_set():
app = FastAPI()
client = TestClient(app)
@app.get("/")
def r... | RuntimeError, match=r"Use params, add_pagination or pagination_ctx") | pytest.raises | complex_expr | tests/test_invalid_usage.py | test_params_not_set | 17 | null | |
sloria/TextBlob | import unittest
import pytest
from textblob.tokenizers import (
SentenceTokenizer,
WordTokenizer,
sent_tokenize,
word_tokenize,
)
def is_generator(obj):
return hasattr(obj, "__next__")
class TestSentenceTokenizer(unittest.TestCase):
def setUp(self):
self.tokenizer = SentenceTokenizer... | 2 | assert | numeric_literal | tests/test_tokenizers.py | test_tokenize_with_multiple_punctuation | TestSentenceTokenizer | 78 | null |
sloria/TextBlob | import unittest
import nltk
import pytest
from textblob.base import BaseNPExtractor
from textblob.np_extractors import ConllExtractor
from textblob.utils import filter_insignificant
class TestConllExtractor(unittest.TestCase):
def setUp(self):
self.extractor = ConllExtractor()
self.text = """
Pyt... | tags | assert | variable | tests/test_np_extractor.py | test_filter_insignificant | TestConllExtractor | 41 | null |
sloria/TextBlob | import unittest
import pytest
from textblob.tokenizers import (
SentenceTokenizer,
WordTokenizer,
sent_tokenize,
word_tokenize,
)
def is_generator(obj):
return hasattr(obj, "__next__")
class TestSentenceTokenizer(unittest.TestCase):
def setUp(self):
self.tokenizer = SentenceTokenizer... | ["OMG!", "I am soooo LOL!!!"] | assert | collection | tests/test_tokenizers.py | test_tokenize_with_multiple_punctuation | TestSentenceTokenizer | 79 | null |
sloria/TextBlob | import unittest
from textblob.en import parse as pattern_parse
from textblob.parsers import PatternParser
class TestPatternParser(unittest.TestCase):
def setUp(self):
self.parser = PatternParser()
self.text = "And now for something completely different."
def test_parse(self):
assert ... | pattern_parse(self.text) | assert | func_call | tests/test_parsers.py | test_parse | TestPatternParser | 13 | null |
sloria/TextBlob | import unittest
import pytest
from textblob.tokenizers import (
SentenceTokenizer,
WordTokenizer,
sent_tokenize,
word_tokenize,
)
def is_generator(obj):
return hasattr(obj, "__next__")
class TestSentenceTokenizer(unittest.TestCase):
def setUp(self):
self.tokenizer = SentenceTokenizer... | "Simple is better than complex." | assert | string_literal | tests/test_tokenizers.py | test_itokenize | TestSentenceTokenizer | 84 | null |
sloria/TextBlob | import json
from datetime import datetime
from unittest import TestCase
import nltk
import pytest
import textblob as tb
import textblob.wordnet as wn
from textblob.classifiers import NaiveBayesClassifier
from textblob.np_extractors import ConllExtractor, FastNPExtractor
from textblob.parsers import PatternParser
from... | 1 | assert | numeric_literal | tests/test_blob.py | test_count | WordListTest | 110 | null |
sloria/TextBlob | import unittest
import pytest
from textblob.sentiments import (
CONTINUOUS,
DISCRETE,
NaiveBayesAnalyzer,
PatternAnalyzer,
)
class TestPatternSentiment(unittest.TestCase):
def setUp(self):
self.analyzer = PatternAnalyzer()
def test_analyze(self):
p1 = "I feel great this morni... | 0 | assert | numeric_literal | tests/test_sentiments.py | test_analyze | TestPatternSentiment | 25 | null |
sloria/TextBlob | import unittest
import pytest
from textblob.sentiments import (
CONTINUOUS,
DISCRETE,
NaiveBayesAnalyzer,
PatternAnalyzer,
)
class TestPatternSentiment(unittest.TestCase):
def setUp(self):
self.analyzer = PatternAnalyzer()
def test_analyze_assessments(self):
p1 = "I feel grea... | p1_assessment[2] | assert | complex_expr | tests/test_sentiments.py | test_analyze_assessments | TestPatternSentiment | 40 | null |
sloria/TextBlob | from unittest import TestCase
from textblob.en.inflect import (
plural_categories,
pluralize,
singular_ie,
singular_irregular,
singularize,
)
class InflectTestCase(TestCase):
def s_singular_pluralize_test(self):
assert pluralize("lens") == "lenses"
def s_singular_singularize_test(... | "diagnosis" | assert | string_literal | tests/test_inflect.py | diagnoses_singularize_test | InflectTestCase | 20 | null |
sloria/TextBlob | import unittest
import pytest
from textblob.sentiments import (
CONTINUOUS,
DISCRETE,
NaiveBayesAnalyzer,
PatternAnalyzer,
)
class TestNaiveBayesAnalyzer(unittest.TestCase):
def setUp(self):
self.analyzer = NaiveBayesAnalyzer()
@pytest.mark.slow
def test_analyze(self):
p1... | "neg" | assert | string_literal | tests/test_sentiments.py | test_analyze | TestNaiveBayesAnalyzer | 56 | null |
sloria/TextBlob | import unittest
import pytest
from textblob.sentiments import (
CONTINUOUS,
DISCRETE,
NaiveBayesAnalyzer,
PatternAnalyzer,
)
class TestPatternSentiment(unittest.TestCase):
def setUp(self):
self.analyzer = PatternAnalyzer()
def test_analyze_assessments(self):
p1 = "I feel grea... | p1_assessment[1] | assert | complex_expr | tests/test_sentiments.py | test_analyze_assessments | TestPatternSentiment | 39 | null |
sloria/TextBlob | import unittest
import pytest
from textblob.tokenizers import (
SentenceTokenizer,
WordTokenizer,
sent_tokenize,
word_tokenize,
)
def is_generator(obj):
return hasattr(obj, "__next__")
class TestWordTokenizer(unittest.TestCase):
def setUp(self):
self.tokenizer = WordTokenizer()
... | [ "Python", "is", "a", "high-level", "programming", "language", ".", ] | assert | collection | tests/test_tokenizers.py | test_tokenize | TestWordTokenizer | 26 | null |
sloria/TextBlob | import os
import unittest
from unittest import mock
import nltk
import pytest
from textblob import formats
from textblob.classifiers import (
DecisionTreeClassifier,
MaxEntClassifier,
NaiveBayesClassifier,
NLTKClassifier,
PositiveNaiveBayesClassifier,
_get_words_from_dataset,
basic_extract... | new_length | assert | variable | tests/test_classifiers.py | test_update | TestNaiveBayesClassifier | 111 | null |
sloria/TextBlob | import unittest
import pytest
from textblob.tokenizers import (
SentenceTokenizer,
WordTokenizer,
sent_tokenize,
word_tokenize,
)
def is_generator(obj):
return hasattr(obj, "__next__")
class TestSentenceTokenizer(unittest.TestCase):
def setUp(self):
self.tokenizer = SentenceTokenizer... | [ "Beautiful is better than ugly.", "Simple is better than complex.", ] | assert | collection | tests/test_tokenizers.py | test_tokenize | TestSentenceTokenizer | 63 | null |
sloria/TextBlob | import unittest
import pytest
from textblob.sentiments import (
CONTINUOUS,
DISCRETE,
NaiveBayesAnalyzer,
PatternAnalyzer,
)
class TestPatternSentiment(unittest.TestCase):
def setUp(self):
self.analyzer = PatternAnalyzer()
def test_kind(self):
assert self.analyzer.kind == | CONTINUOUS | assert | variable | tests/test_sentiments.py | test_kind | TestPatternSentiment | 18 | null |
sloria/TextBlob | import unittest
import pytest
from textblob.tokenizers import (
SentenceTokenizer,
WordTokenizer,
sent_tokenize,
word_tokenize,
)
def is_generator(obj):
return hasattr(obj, "__next__")
class TestWordTokenizer(unittest.TestCase):
def setUp(self):
self.tokenizer = WordTokenizer()
... | self.tokenizer.tokenize(self.text) | assert | func_call | tests/test_tokenizers.py | test_word_tokenize | TestWordTokenizer | 54 | null |
sloria/TextBlob | import json
from datetime import datetime
from unittest import TestCase
import nltk
import pytest
import textblob as tb
import textblob.wordnet as wn
from textblob.classifiers import NaiveBayesClassifier
from textblob.np_extractors import ConllExtractor, FastNPExtractor
from textblob.parsers import PatternParser
from... | 6 | assert | numeric_literal | tests/test_blob.py | test_np_counts | TextBlobTest | 619 | null |
sloria/TextBlob | import os
import unittest
from unittest import mock
import nltk
import pytest
from textblob import formats
from textblob.classifiers import (
DecisionTreeClassifier,
MaxEntClassifier,
NaiveBayesClassifier,
NLTKClassifier,
PositiveNaiveBayesClassifier,
_get_words_from_dataset,
basic_extract... | labels | assert | variable | tests/test_classifiers.py | test_labels | TestNaiveBayesClassifier | 115 | null |
sloria/TextBlob | import unittest
import pytest
from textblob.tokenizers import (
SentenceTokenizer,
WordTokenizer,
sent_tokenize,
word_tokenize,
)
def is_generator(obj):
return hasattr(obj, "__next__")
class TestWordTokenizer(unittest.TestCase):
def setUp(self):
self.tokenizer = WordTokenizer()
... | [ "Python", "is", "a", "high-level", "programming", "language", ] | assert | collection | tests/test_tokenizers.py | test_exclude_punc | TestWordTokenizer | 37 | null |
sloria/TextBlob | import unittest
import pytest
from textblob.tokenizers import (
SentenceTokenizer,
WordTokenizer,
sent_tokenize,
word_tokenize,
)
def is_generator(obj):
return hasattr(obj, "__next__")
class TestSentenceTokenizer(unittest.TestCase):
def setUp(self):
self.tokenizer = SentenceTokenizer... | "Beautiful is better than ugly." | assert | string_literal | tests/test_tokenizers.py | test_itokenize | TestSentenceTokenizer | 83 | null |
sloria/TextBlob | import unittest
import pytest
from textblob.tokenizers import (
SentenceTokenizer,
WordTokenizer,
sent_tokenize,
word_tokenize,
)
def is_generator(obj):
return hasattr(obj, "__next__")
class TestWordTokenizer(unittest.TestCase):
def setUp(self):
self.tokenizer = WordTokenizer()
... | "Python" | assert | string_literal | tests/test_tokenizers.py | test_itokenize | TestWordTokenizer | 48 | null |
sloria/TextBlob | from unittest import TestCase
from textblob.en.inflect import (
plural_categories,
pluralize,
singular_ie,
singular_irregular,
singularize,
)
class InflectTestCase(TestCase):
def s_singular_pluralize_test(self):
assert pluralize("lens") == "lenses"
def s_singular_singularize_test(... | w | assert | variable | tests/test_inflect.py | test_all_singular_s | InflectTestCase | 27 | null |
sloria/TextBlob | import os
import unittest
from unittest import mock
import nltk
import pytest
from textblob import formats
from textblob.classifiers import (
DecisionTreeClassifier,
MaxEntClassifier,
NaiveBayesClassifier,
NLTKClassifier,
PositiveNaiveBayesClassifier,
_get_words_from_dataset,
basic_extract... | pf | assert | variable | tests/test_classifiers.py | test_pretty_format | TestDecisionTreeClassifier | 246 | null |
sloria/TextBlob | import unittest
import pytest
from textblob.sentiments import (
CONTINUOUS,
DISCRETE,
NaiveBayesAnalyzer,
PatternAnalyzer,
)
class TestNaiveBayesAnalyzer(unittest.TestCase):
def setUp(self):
self.analyzer = NaiveBayesAnalyzer()
@pytest.mark.slow
def test_analyze(self):
p1... | 1) | assert_* | numeric_literal | tests/test_sentiments.py | test_analyze | TestNaiveBayesAnalyzer | 61 | null |
sloria/TextBlob | import json
from datetime import datetime
from unittest import TestCase
import nltk
import pytest
import textblob as tb
import textblob.wordnet as wn
from textblob.classifiers import NaiveBayesClassifier
from textblob.np_extractors import ConllExtractor, FastNPExtractor
from textblob.parsers import PatternParser
from... | 2 | assert | numeric_literal | tests/test_blob.py | test_count | WordListTest | 109 | null |
sloria/TextBlob | import os
import unittest
import pytest
import textblob.taggers
from textblob.base import BaseTagger
HERE = os.path.abspath(os.path.dirname(__file__))
AP_MODEL_LOC = os.path.join(HERE, "trontagger.pickle")
class TestNLTKTagger(unittest.TestCase):
def setUp(self):
self.text = "Simple is better than compl... | [ ("Simple", "NN"), ("is", "VBZ"), ("better", "JJR"), ("than", "IN"), ("complex", "JJ"), (".", "."), ("Complex", "NNP"), ("is", "VBZ"), ("better", "JJR"), ("than", "IN"), ("complicated", "VBN"), (".", "."), ] | assert | collection | tests/test_taggers.py | test_tag | TestNLTKTagger | 49 | null |
sloria/TextBlob | import unittest
import pytest
from textblob.tokenizers import (
SentenceTokenizer,
WordTokenizer,
sent_tokenize,
word_tokenize,
)
def is_generator(obj):
return hasattr(obj, "__next__")
class TestWordTokenizer(unittest.TestCase):
def setUp(self):
self.tokenizer = WordTokenizer()
... | "is" | assert | string_literal | tests/test_tokenizers.py | test_itokenize | TestWordTokenizer | 49 | null |
sloria/TextBlob | import os
from unittest import TestCase
from textblob.utils import is_filelike, lowerstrip, strip_punc
HERE = os.path.abspath(os.path.dirname(__file__))
CSV_FILE = os.path.join(HERE, "data.csv")
class UtilsTests(TestCase):
def setUp(self):
self.text = "this. Has. Punctuation?! "
def test_strip_punc_... | "this Has Punctuation" | assert | string_literal | tests/test_utils.py | test_strip_punc_all | UtilsTests | 18 | null |
sloria/TextBlob | import os
from unittest import TestCase
from textblob.utils import is_filelike, lowerstrip, strip_punc
HERE = os.path.abspath(os.path.dirname(__file__))
CSV_FILE = os.path.join(HERE, "data.csv")
class UtilsTests(TestCase):
def setUp(self):
self.text = "this. Has. Punctuation?! "
def test_lowerstrip(... | "this. has. punctuation" | assert | string_literal | tests/test_utils.py | test_lowerstrip | UtilsTests | 21 | null |
sloria/TextBlob | import json
from datetime import datetime
from unittest import TestCase
import nltk
import pytest
import textblob as tb
import textblob.wordnet as wn
from textblob.classifiers import NaiveBayesClassifier
from textblob.np_extractors import ConllExtractor, FastNPExtractor
from textblob.parsers import PatternParser
from... | 3 | assert | numeric_literal | tests/test_blob.py | test_len | WordListTest | 56 | null |
sloria/TextBlob | import os
import unittest
from unittest import mock
import nltk
import pytest
from textblob import formats
from textblob.classifiers import (
DecisionTreeClassifier,
MaxEntClassifier,
NaiveBayesClassifier,
NLTKClassifier,
PositiveNaiveBayesClassifier,
_get_words_from_dataset,
basic_extract... | "positive" | assert | string_literal | tests/test_classifiers.py | test_classify | TestNaiveBayesClassifier | 82 | null |
sloria/TextBlob | import os
import unittest
import pytest
import textblob.taggers
from textblob.base import BaseTagger
HERE = os.path.abspath(os.path.dirname(__file__))
AP_MODEL_LOC = os.path.join(HERE, "trontagger.pickle")
class TestPatternTagger(unittest.TestCase):
def setUp(self):
self.text = "Simple is better than co... | [ ("Simple", "JJ"), ("is", "VBZ"), ("better", "JJR"), ("than", "IN"), ("complex", "JJ"), (".", "."), ("Complex", "NNP"), ("is", "VBZ"), ("better", "JJR"), ("than", "IN"), ("complicated", "VBN"), (".", "."), ] | assert | collection | tests/test_taggers.py | test_tag | TestPatternTagger | 24 | null |
sloria/TextBlob | import unittest
import pytest
from textblob.sentiments import (
CONTINUOUS,
DISCRETE,
NaiveBayesAnalyzer,
PatternAnalyzer,
)
class TestNaiveBayesAnalyzer(unittest.TestCase):
def setUp(self):
self.analyzer = NaiveBayesAnalyzer()
def test_kind(self):
assert self.analyzer.kind ... | DISCRETE | assert | variable | tests/test_sentiments.py | test_kind | TestNaiveBayesAnalyzer | 48 | null |
sloria/TextBlob | import os
import unittest
from unittest import mock
import nltk
import pytest
from textblob import formats
from textblob.classifiers import (
DecisionTreeClassifier,
MaxEntClassifier,
NaiveBayesClassifier,
NLTKClassifier,
PositiveNaiveBayesClassifier,
_get_words_from_dataset,
basic_extract... | "pos" | assert | string_literal | tests/test_classifiers.py | test_init_with_csv_file | TestNaiveBayesClassifier | 134 | null |
sloria/TextBlob | from unittest import TestCase
from textblob.en.inflect import (
plural_categories,
pluralize,
singular_ie,
singular_irregular,
singularize,
)
class InflectTestCase(TestCase):
def s_singular_pluralize_test(self):
assert pluralize("lens") == "lenses"
def s_singular_singularize_test(... | "buses" | assert | string_literal | tests/test_inflect.py | bus_pluralize_test | InflectTestCase | 23 | null |
sloria/TextBlob | import unittest
import pytest
from textblob.decorators import requires_nltk_corpus
from textblob.exceptions import MissingCorpusError
def test_decorator_raises_missing_corpus_exception():
t = Tokenizer()
with pytest.raises( | MissingCorpusError) | pytest.raises | variable | tests/test_decorators.py | test_decorator_raises_missing_corpus_exception | 17 | null | |
sloria/TextBlob | import unittest
import pytest
from textblob.tokenizers import (
SentenceTokenizer,
WordTokenizer,
sent_tokenize,
word_tokenize,
)
def is_generator(obj):
return hasattr(obj, "__next__")
class TestSentenceTokenizer(unittest.TestCase):
def setUp(self):
self.tokenizer = SentenceTokenizer... | [ "Hello world.", "How do you do?!", "My name's Steve...", ] | assert | collection | tests/test_tokenizers.py | test_tokenize_with_multiple_punctuation | TestSentenceTokenizer | 71 | null |
sloria/TextBlob | import os
import unittest
from unittest import mock
import nltk
import pytest
from textblob import formats
from textblob.classifiers import (
DecisionTreeClassifier,
MaxEntClassifier,
NaiveBayesClassifier,
NLTKClassifier,
PositiveNaiveBayesClassifier,
_get_words_from_dataset,
basic_extract... | code | assert | variable | tests/test_classifiers.py | test_pseudocode | TestDecisionTreeClassifier | 240 | null |
sloria/TextBlob | import os
import unittest
from textblob import formats
HERE = os.path.abspath(os.path.dirname(__file__))
CSV_FILE = os.path.join(HERE, "data.csv")
JSON_FILE = os.path.join(HERE, "data.json")
TSV_FILE = os.path.join(HERE, "data.tsv")
class TestFormats(unittest.TestCase):
def setUp(self):
pass
def tes... | formats.CSV | assert | complex_expr | tests/test_formats.py | test_detect_csv | TestFormats | 19 | null |
sloria/TextBlob | import os
import unittest
from textblob import formats
HERE = os.path.abspath(os.path.dirname(__file__))
CSV_FILE = os.path.join(HERE, "data.csv")
JSON_FILE = os.path.join(HERE, "data.json")
TSV_FILE = os.path.join(HERE, "data.tsv")
class TestRegistry(unittest.TestCase):
def setUp(self):
pass
def te... | registry.values() | assert | func_call | tests/test_formats.py | test_register | TestRegistry | 112 | null |
sloria/TextBlob | import os
import unittest
from textblob import formats
HERE = os.path.abspath(os.path.dirname(__file__))
CSV_FILE = os.path.join(HERE, "data.csv")
JSON_FILE = os.path.join(HERE, "data.json")
TSV_FILE = os.path.join(HERE, "data.tsv")
class TestFormats(unittest.TestCase):
def setUp(self):
pass
def tes... | registry.keys() | assert | func_call | tests/test_formats.py | test_available | TestFormats | 28 | null |
sloria/TextBlob | import os
from unittest import TestCase
from textblob.utils import is_filelike, lowerstrip, strip_punc
HERE = os.path.abspath(os.path.dirname(__file__))
CSV_FILE = os.path.join(HERE, "data.csv")
class UtilsTests(TestCase):
def setUp(self):
self.text = "this. Has. Punctuation?! "
def test_strip_punc(... | "this. Has. Punctuation" | assert | string_literal | tests/test_utils.py | test_strip_punc | UtilsTests | 15 | null |
sloria/TextBlob | import unittest
import pytest
from textblob.sentiments import (
CONTINUOUS,
DISCRETE,
NaiveBayesAnalyzer,
PatternAnalyzer,
)
def assert_about_equal(first, second, places=4):
assert round(first, places) == | second | assert | variable | tests/test_sentiments.py | assert_about_equal | 68 | null | |
innovatorved/subtitle | import os
import pytest
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from src.utils.validators import (
validate_video_path,
validate_audio_path,
validate_media_path,
validate_model_name,
validate_output_format,
get_available_model... | True | assert | bool_literal | tests/unit/test_validators.py | test_valid_extension | TestValidateVideoPath | 42 | null |
innovatorved/subtitle | import os
import pytest
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from src.utils.formatters import (
SubtitleSegment,
VTTFormatter,
SRTFormatter,
SubtitleFormatterFactory,
convert_subtitle_format,
)
class TestSubtitleSegment:
... | 5.0 | assert | numeric_literal | tests/unit/test_formatters.py | test_segment_creation | TestSubtitleSegment | 34 | null |
innovatorved/subtitle | import os
import pytest
import sys
import tempfile
from pathlib import Path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from src.config.settings import Settings, WhisperSettings, PathSettings
from src.config.config_loader import load_config, _deep_merge, reset_conf... | 2 | assert | numeric_literal | tests/unit/test_config.py | test_load_custom_config | TestConfigLoader | 112 | null |
innovatorved/subtitle | import os
import pytest
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from src.utils.exceptions import (
SubtitleError,
TranscriptionError,
VideoProcessingError,
ModelError,
ValidationError,
ConfigurationError,
DownloadError,
... | 3 | assert | numeric_literal | tests/unit/test_exceptions.py | test_retry_succeeds_after_failures | TestRetryDecorator | 118 | null |
innovatorved/subtitle | import os
import pytest
import sys
import tempfile
from pathlib import Path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from src.config.settings import Settings, WhisperSettings, PathSettings
from src.config.config_loader import load_config, _deep_merge, reset_conf... | "vtt" | assert | string_literal | tests/unit/test_config.py | test_default_settings | TestSettings | 26 | null |
innovatorved/subtitle | import os
import pytest
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from src.utils.validators import (
validate_video_path,
validate_audio_path,
validate_media_path,
validate_model_name,
validate_output_format,
get_available_model... | formats | assert | variable | tests/unit/test_validators.py | test_get_supported_formats | TestGetters | 119 | null |
innovatorved/subtitle | import os
import pytest
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from src.utils.exceptions import (
SubtitleError,
TranscriptionError,
VideoProcessingError,
ModelError,
ValidationError,
ConfigurationError,
DownloadError,
... | ValueError) | pytest.raises | variable | tests/unit/test_exceptions.py | test_retry_exhausted | TestRetryDecorator | 129 | null |
innovatorved/subtitle | import os
import pytest
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from src.utils.formatters import (
SubtitleSegment,
VTTFormatter,
SRTFormatter,
SubtitleFormatterFactory,
convert_subtitle_format,
)
class TestSubtitleSegment:
... | "Hello, world!" | assert | string_literal | tests/unit/test_formatters.py | test_segment_creation | TestSubtitleSegment | 35 | null |
innovatorved/subtitle | import json
import os
import pytest
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from src.core.batch_processor import (
BatchProcessor,
BatchState,
BatchFileResult,
BatchSummary,
DEFAULT_VIDEO_EXTENSIONS,
)
class TestBatchProcessor:
... | 2 | assert | numeric_literal | tests/unit/test_batch_processor.py | test_find_video_files | TestBatchProcessor | 66 | null |
innovatorved/subtitle | import os
import pytest
import sys
import tempfile
from pathlib import Path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from src.config.settings import Settings, WhisperSettings, PathSettings
from src.config.config_loader import load_config, _deep_merge, reset_conf... | 3 | assert | numeric_literal | tests/unit/test_config.py | test_simple_merge | TestDeepMerge | 67 | null |
innovatorved/subtitle | import asyncio
import os
import pytest
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from src.core.async_processor import AsyncProcessor
from src.core.batch_processor import BatchFileResult, BatchSummary
class TestAsyncProcessor:
async def run_te... | 0 | assert | numeric_literal | tests/unit/test_async_processor.py | run_test | TestAsyncProcessor | 66 | null |
innovatorved/subtitle | import os
import pytest
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from src.utils.exceptions import (
SubtitleError,
TranscriptionError,
VideoProcessingError,
ModelError,
ValidationError,
ConfigurationError,
DownloadError,
... | 1 | assert | numeric_literal | tests/unit/test_exceptions.py | test_retry_succeeds_first_try | TestRetryDecorator | 102 | null |
innovatorved/subtitle | import asyncio
import os
import pytest
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from src.core.async_processor import AsyncProcessor
from src.core.batch_processor import BatchFileResult, BatchSummary
class TestAsyncProcessor:
def test_init_defaul... | None | assert | none_literal | tests/unit/test_async_processor.py | test_init_default_values | TestAsyncProcessor | 24 | null |
innovatorved/subtitle | import json
import os
import pytest
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from src.core.batch_processor import (
BatchProcessor,
BatchState,
BatchFileResult,
BatchSummary,
DEFAULT_VIDEO_EXTENSIONS,
)
class TestBatchProcessor:
... | 8 | assert | numeric_literal | tests/unit/test_batch_processor.py | test_init_custom_values | TestBatchProcessor | 42 | null |
innovatorved/subtitle | import os
import pytest
from unittest.mock import patch, MagicMock
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from src.models.model_manager import ModelManager
class TestModelManager:
def setup_method(self):
"""Reset singleton before each ... | path | assert | variable | tests/unit/test_model_manager.py | test_get_model_path | TestModelManager | 59 | null |
innovatorved/subtitle | import asyncio
import os
import pytest
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from src.core.async_processor import AsyncProcessor
from src.core.batch_processor import BatchFileResult, BatchSummary
class TestBatchFileResultIntegration:
def test... | "/subs/video.vtt" | assert | string_literal | tests/unit/test_async_processor.py | test_result_creation_success | TestBatchFileResultIntegration | 158 | null |
innovatorved/subtitle | import os
import pytest
import sys
import tempfile
from pathlib import Path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from src.config.settings import Settings, WhisperSettings, PathSettings
from src.config.config_loader import load_config, _deep_merge, reset_conf... | 1 | assert | numeric_literal | tests/unit/test_config.py | test_simple_merge | TestDeepMerge | 66 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.