text stringlengths 0 1.05M | meta dict |
|---|---|
from django.test import SimpleTestCase
from corehq import ReportConfiguration
from corehq.apps.userreports.exceptions import BadSpecError
from corehq.apps.userreports.reports.factory import ChartFactory
from corehq.apps.userreports.reports.specs import PieChartSpec, MultibarChartSpec, MultibarAggregateChartSpec
class... | {
"repo_name": "puttarajubr/commcare-hq",
"path": "corehq/apps/userreports/tests/test_report_charts.py",
"copies": "2",
"size": "4282",
"license": "bsd-3-clause",
"hash": -103813606341874690,
"line_mean": 32.453125,
"line_max": 109,
"alpha_frac": 0.5511443251,
"autogenerated": false,
"ratio": 4.40... |
from django.test import SimpleTestCase
from django.test.client import RequestFactory
from . import views
import crits.signatures.handlers as handlers
from crits.core.user import CRITsUser
from crits.core.handlers import add_new_source
from crits.signatures.handlers import add_new_signature_type, handle_signature_file
... | {
"repo_name": "Magicked/crits",
"path": "crits/signatures/tests.py",
"copies": "4",
"size": "3824",
"license": "mit",
"hash": 3639455922447887000,
"line_mean": 29.592,
"line_max": 105,
"alpha_frac": 0.6281380753,
"autogenerated": false,
"ratio": 3.858728557013118,
"config_test": true,
"has_no... |
from django.test import SimpleTestCase
from django.test.client import RequestFactory
import crits.domains.views as views
import crits.domains.handlers as handlers
from crits.core.user import CRITsUser
from crits.core.handlers import add_new_source
from crits.core.source_access import SourceAccess
TSRC = "TestSource"
... | {
"repo_name": "blaquee/crits",
"path": "crits/domains/tests.py",
"copies": "21",
"size": "3580",
"license": "mit",
"hash": 6198508574191782000,
"line_mean": 27.188976378,
"line_max": 78,
"alpha_frac": 0.5812849162,
"autogenerated": false,
"ratio": 3.812566560170394,
"config_test": true,
"has_... |
from django.test import SimpleTestCase
from django.test.client import RequestFactory
import crits.signatures.views as views
import crits.signatures.handlers as handlers
from crits.core.user import CRITsUser
from crits.core.handlers import add_new_source
from crits.signatures.handlers import add_new_signature_type, han... | {
"repo_name": "ckane/crits",
"path": "crits/signatures/tests.py",
"copies": "11",
"size": "3842",
"license": "mit",
"hash": -1710326432907354600,
"line_mean": 29.744,
"line_max": 105,
"alpha_frac": 0.6298802707,
"autogenerated": false,
"ratio": 3.8613065326633165,
"config_test": true,
"has_no... |
from django.test import SimpleTestCase
from django.test import TestCase
class GetEnvSettingTests(SimpleTestCase):
def test_falsey_default(self):
from common.utils import get_env_setting
self.assertEqual(get_env_setting('FROB123', ''), '')
class TitleCaseTests(SimpleTestCase):
def test_variao... | {
"repo_name": "annapowellsmith/openpresc",
"path": "openprescribing/frontend/tests/test_common_utils.py",
"copies": "1",
"size": "3261",
"license": "mit",
"hash": -3275622602860871700,
"line_mean": 29.476635514,
"line_max": 78,
"alpha_frac": 0.4866605336,
"autogenerated": false,
"ratio": 4.218628... |
from django.test import SimpleTestCase
from django.utils.hashable import make_hashable
class TestHashable(SimpleTestCase):
def test_equal(self):
tests = (
([], ()),
(['a', 1], ('a', 1)),
({}, ()),
({'a'}, ('a',)),
(frozenset({'a'}), {'a'}),
... | {
"repo_name": "elena/django",
"path": "tests/utils_tests/test_hashable.py",
"copies": "19",
"size": "1248",
"license": "bsd-3-clause",
"hash": -4555740607902774000,
"line_mean": 33.6666666667,
"line_max": 82,
"alpha_frac": 0.422275641,
"autogenerated": false,
"ratio": 3.6705882352941175,
"confi... |
from django.test import SimpleTestCase
from django.utils import translation
from ...utils import setup
class I18nGetLanguageInfoTagTests(SimpleTestCase):
libraries = {
'custom': 'template_tests.templatetags.custom',
'i18n': 'django.templatetags.i18n',
}
# retrieving language information
... | {
"repo_name": "dfdx2/django",
"path": "tests/template_tests/syntax_tests/i18n/test_get_language_info.py",
"copies": "55",
"size": "1551",
"license": "bsd-3-clause",
"hash": 8976644634908820000,
"line_mean": 42.0555555556,
"line_max": 91,
"alpha_frac": 0.5522580645,
"autogenerated": false,
"ratio"... |
from django.test import SimpleTestCase
from geopositionmap import LatLng
from example.models import POI
class GeopositionTestCase(SimpleTestCase):
def test_init_with_strs(self):
gp = LatLng('52.5', '-13.4')
self.assertEqual(gp.lat, float('52.5'))
self.assertEqual(gp.lng, float('-13.4'))
... | {
"repo_name": "ivandm/django-geopositionmap",
"path": "geopositionmap/tests/test_geoposition.py",
"copies": "1",
"size": "1989",
"license": "mit",
"hash": -5123233362346225000,
"line_mean": 29.6,
"line_max": 73,
"alpha_frac": 0.5600804424,
"autogenerated": false,
"ratio": 2.8132956152758135,
"c... |
from django.test import SimpleTestCase
from mock import patch, Mock
from corehq.apps.accounting.models import (
Subscription, BillingAccount, DefaultProductPlan, SoftwarePlanEdition,
Subscriber)
from corehq.apps.accounting.subscription_changes import DomainDowngradeActionHandler
from corehq.apps.accounting.tes... | {
"repo_name": "qedsoftware/commcare-hq",
"path": "corehq/apps/accounting/tests/test_subscription_changes.py",
"copies": "1",
"size": "7914",
"license": "bsd-3-clause",
"hash": -2480781294354346000,
"line_mean": 39.3775510204,
"line_max": 110,
"alpha_frac": 0.646702047,
"autogenerated": false,
"ra... |
from django.test import SimpleTestCase
from unittest import mock
from zeusci.zeus.exceptions import FetcherError
from zeusci.zeus.fetchers import Fetcher
from zeusci.zeus.fetchers import GitFetcher
class TestFetcher(SimpleTestCase):
def setUp(self):
self.fetcher = Fetcher()
@mock.patch('zeusci.zeus.... | {
"repo_name": "lukaszb/zeusci",
"path": "zeusci/zeus/tests/test_fetchers.py",
"copies": "1",
"size": "2847",
"license": "mit",
"hash": 8126968315964076000,
"line_mean": 32.1046511628,
"line_max": 75,
"alpha_frac": 0.5872848613,
"autogenerated": false,
"ratio": 3.4136690647482015,
"config_test":... |
from django.test import SimpleTestCase
from canary_endpoint.constants import OK, WARNING, ERROR
from canary_endpoint.mocks import MockTestCaseMixin, MockRequestsMixin
from canary_endpoint.resources.services import ServiceWithCanary
class ServiceWithCanaryTestCase(MockRequestsMixin,
Mo... | {
"repo_name": "TabbedOut/django_canary_endpoint",
"path": "tests/test_service_resources.py",
"copies": "1",
"size": "1923",
"license": "mit",
"hash": -5653084059118086000,
"line_mean": 40.8043478261,
"line_max": 76,
"alpha_frac": 0.6645865835,
"autogenerated": false,
"ratio": 4.144396551724138,
... |
from django.test import SimpleTestCase
from cfp import models, fakedata
class ModelTest(SimpleTestCase):
def test_token_len(self):
self.assertEquals(10, len(models.token(10)))
def test_token_not_same(self):
self.assertNotEquals(models.token(10), models.token(10))
def test_submit(self):
... | {
"repo_name": "kyleconroy/speakers",
"path": "cfp/tests/test_models.py",
"copies": "1",
"size": "1338",
"license": "mit",
"hash": 4404878867262695400,
"line_mean": 37.2285714286,
"line_max": 78,
"alpha_frac": 0.6405082212,
"autogenerated": false,
"ratio": 3.2874692874692877,
"config_test": true... |
from django.test import SimpleTestCase
from corehq.apps.couch_sql_migration.diff import (
filter_form_diffs, FORM_IGNORED_DIFFS, PARTIAL_DIFFS,
filter_case_diffs, CASE_IGNORED_DIFFS, filter_ledger_diffs
)
from corehq.apps.tzmigration.timezonemigration import FormJsonDiff
from corehq.util.test_utils import soft... | {
"repo_name": "qedsoftware/commcare-hq",
"path": "corehq/apps/couch_sql_migration/tests/test_diffs.py",
"copies": "1",
"size": "6538",
"license": "bsd-3-clause",
"hash": 7503796537581321000,
"line_mean": 38.8658536585,
"line_max": 130,
"alpha_frac": 0.6052309575,
"autogenerated": false,
"ratio": ... |
from django.test import SimpleTestCase
from cripts.relationships.handlers import forge_relationship, update_relationship_reasons, update_relationship_confidences
from cripts.core.user import CRIPTsUser
from cripts.vocabulary.relationships import RelationshipTypes
TUSER_NAME = "test_user"
TUSER_PASS = "!@#j54kfeimn?>S... | {
"repo_name": "lakiw/cripts",
"path": "cripts/relationships/tests.py",
"copies": "1",
"size": "2022",
"license": "mit",
"hash": 6381719763739376000,
"line_mean": 27.0833333333,
"line_max": 122,
"alpha_frac": 0.6088031652,
"autogenerated": false,
"ratio": 3.5165217391304346,
"config_test": true,... |
from django.test import SimpleTestCase
from crits.relationships.handlers import forge_relationship, update_relationship_reasons, update_relationship_confidences
from crits.core.user import CRITsUser
from crits.campaigns.campaign import Campaign
from crits.vocabulary.relationships import RelationshipTypes
TUSER_NAME =... | {
"repo_name": "Magicked/crits",
"path": "crits/relationships/tests.py",
"copies": "10",
"size": "5155",
"license": "mit",
"hash": 4397155621093827000,
"line_mean": 43.8260869565,
"line_max": 121,
"alpha_frac": 0.6349175558,
"autogenerated": false,
"ratio": 3.7274041937816342,
"config_test": tru... |
from django.test import SimpleTestCase
from django_perf_rec.utils import current_test, sorted_names
class CurrentTestTests(SimpleTestCase):
def test_here(self):
details = current_test()
assert details.file_path == __file__
assert details.class_name == "CurrentTestTests"
assert det... | {
"repo_name": "YPlan/django-perf-rec",
"path": "tests/test_utils.py",
"copies": "1",
"size": "1212",
"license": "mit",
"hash": -6866181286075709000,
"line_mean": 29.3,
"line_max": 65,
"alpha_frac": 0.6237623762,
"autogenerated": false,
"ratio": 3.9478827361563518,
"config_test": true,
"has_no... |
from django.test import SimpleTestCase
from flashpolicies import policies
class PolicyGeneratorTests(SimpleTestCase):
"""
Tests the policy-file generation utilities.
"""
dummy_fingerprint = "01:23:45:67:89:ab:cd:ef:01:23:45:67:89:ab:cd:ef:01:23:45:67"
def test_policy_str(self):
"""
... | {
"repo_name": "ubernostrum/django-flashpolicies",
"path": "tests/test_policies.py",
"copies": "1",
"size": "10618",
"license": "bsd-3-clause",
"hash": 7102636474227313000,
"line_mean": 36.1258741259,
"line_max": 88,
"alpha_frac": 0.6320399322,
"autogenerated": false,
"ratio": 4.242109468637635,
... |
from django.test import SimpleTestCase
from localflavor.gr.forms import GRMobilePhoneNumberField, GRPhoneNumberField, GRPostalCodeField, GRTaxNumberCodeField
class GRLocalFlavorTests(SimpleTestCase):
def test_GRTaxNumberField(self):
"""The valid tests are from greek tax numbers (AFMs) found on the inter... | {
"repo_name": "thor/django-localflavor",
"path": "tests/test_gr.py",
"copies": "3",
"size": "2736",
"license": "bsd-3-clause",
"hash": -6989385593821099000,
"line_mean": 29.4,
"line_max": 118,
"alpha_frac": 0.5168128655,
"autogenerated": false,
"ratio": 3.9197707736389686,
"config_test": true,
... |
from django.test import SimpleTestCase
from natural_query.fields import DateTimeNaturalQueryField
from natural_query.query import DatePartNaturalQueryDescriptor
from tests.common.support.models import TestModel
class NaturalQueryFieldTestCase(SimpleTestCase):
def test_a_datetime_query_descriptor_is_added_to_the... | {
"repo_name": "thedrow/django-natural-query",
"path": "tests/unit/test_datetime_natural_query_field.py",
"copies": "1",
"size": "2194",
"license": "bsd-3-clause",
"hash": -2264987961677706200,
"line_mean": 38.8909090909,
"line_max": 112,
"alpha_frac": 0.7114858706,
"autogenerated": false,
"ratio"... |
from django.test import SimpleTestCase
from .utils import render, setup
class CommentSyntaxTests(SimpleTestCase):
@setup({'comment-syntax01': '{# this is hidden #}hello'})
def test_comment_syntax01(self):
output = render('comment-syntax01')
self.assertEqual(output, 'hello')
@setup({'com... | {
"repo_name": "andyzsf/django",
"path": "tests/template_tests/syntax_tests/test_comment.py",
"copies": "1",
"size": "3300",
"license": "bsd-3-clause",
"hash": -5773958279170227000,
"line_mean": 34.8695652174,
"line_max": 86,
"alpha_frac": 0.5987878788,
"autogenerated": false,
"ratio": 3.691275167... |
from django.test import SimpleTestCase
from ..utils import render, setup
class SpacelessTagTests(SimpleTestCase):
@setup({'spaceless01': "{% spaceless %} <b> <i> text </i> </b> {% endspaceless %}"})
def test_spaceless01(self):
output = render('spaceless01')
self.assertEqual(output, "<b... | {
"repo_name": "gdi2290/django",
"path": "tests/template_tests/syntax_tests/test_spaceless.py",
"copies": "2",
"size": "1642",
"license": "bsd-3-clause",
"hash": 8274377259556888000,
"line_mean": 42.2105263158,
"line_max": 98,
"alpha_frac": 0.5438489647,
"autogenerated": false,
"ratio": 3.35787321... |
from django.test import SimpleTestCase
from ..utils import setup
class InvalidStringTests(SimpleTestCase):
libraries = {'i18n': 'django.templatetags.i18n'}
@setup({'invalidstr01': '{{ var|default:"Foo" }}'})
def test_invalidstr01(self):
output = self.engine.render_to_string('invalidstr01')
... | {
"repo_name": "theo-l/django",
"path": "tests/template_tests/syntax_tests/test_invalid_string.py",
"copies": "35",
"size": "2318",
"license": "bsd-3-clause",
"hash": 8432387295567177000,
"line_mean": 36.3870967742,
"line_max": 99,
"alpha_frac": 0.6056945643,
"autogenerated": false,
"ratio": 3.818... |
from django.test import SimpleTestCase
import mock
from nose.tools import eq_
from test_utils import RequestFactory
from commonware.log.middleware import (_local, ThreadRequestMiddleware,
get_remote_addr, get_username)
class ThreadRequestMiddlewareTests(SimpleTestCase):
de... | {
"repo_name": "jsocol/commonware",
"path": "commonware/log/tests.py",
"copies": "1",
"size": "1483",
"license": "bsd-3-clause",
"hash": 8889535894210004000,
"line_mean": 34.3095238095,
"line_max": 71,
"alpha_frac": 0.6122724208,
"autogenerated": false,
"ratio": 3.9441489361702127,
"config_test"... |
from django.test import SimpleTestCase
import numpy
import scipy.sparse
from matrixstore.sql_functions import fast_in_place_add, MatrixSum
class TestMatrixSum(SimpleTestCase):
def test_simple_addition(self):
matrix_a = [[1, 0, 2], [0, 0, 0], [0, 4, 5], [2, 3, 2]]
matrix_b = [[0, 0, 0], [0, 0, 4]... | {
"repo_name": "ebmdatalab/openprescribing",
"path": "openprescribing/matrixstore/tests/test_sql_functions.py",
"copies": "1",
"size": "1441",
"license": "mit",
"hash": -2942150911290585000,
"line_mean": 36.9210526316,
"line_max": 86,
"alpha_frac": 0.5641915337,
"autogenerated": false,
"ratio": 2.... |
from django.test import SimpleTestCase, override_settings
from django_prometheus.testutils import PrometheusTestCaseMixin
from testapp.views import ObjectionException
def M(metric_name):
"""Makes a full metric name from a short metric name.
This is just intended to help keep the lines shorter in test
cas... | {
"repo_name": "korfuri/django-prometheus",
"path": "django_prometheus/tests/end2end/testapp/test_middleware.py",
"copies": "1",
"size": "5286",
"license": "apache-2.0",
"hash": -1654113149782459000,
"line_mean": 33.7763157895,
"line_max": 88,
"alpha_frac": 0.587779039,
"autogenerated": false,
"ra... |
from django.test import SimpleTestCase, override_settings
from django.test.utils import require_jinja2
@override_settings(ROOT_URLCONF='shortcuts.urls')
class RenderTests(SimpleTestCase):
def test_render(self):
response = self.client.get('/render/')
self.assertEqual(response.status_code, 200)
... | {
"repo_name": "tomchristie/django",
"path": "tests/shortcuts/tests.py",
"copies": "109",
"size": "1737",
"license": "bsd-3-clause",
"hash": 3974838308224309000,
"line_mean": 44.7105263158,
"line_max": 85,
"alpha_frac": 0.6885434657,
"autogenerated": false,
"ratio": 3.784313725490196,
"config_te... |
from django.test import SimpleTestCase, override_settings
from cloudinary_storage.storage import StaticHashedCloudinaryStorage
from tests.tests.test_helpers import execute_command, StaticHashedStorageTestsMixin, import_mock
mock = import_mock()
@override_settings(STATICFILES_STORAGE='cloudinary_storage.storage.Stat... | {
"repo_name": "klis87/django-cloudinary-storage",
"path": "tests/tests/test_index_page.py",
"copies": "1",
"size": "2690",
"license": "mit",
"hash": -5907263065873149000,
"line_mean": 44.593220339,
"line_max": 109,
"alpha_frac": 0.7319702602,
"autogenerated": false,
"ratio": 3.804809052333805,
... |
from django.test import SimpleTestCase, override_settings
from rest_framework.fields import ChoiceField, IntegerField
from rest_framework.serializers import Serializer
from rest_witchcraft.fields import HyperlinkedIdentityField, ImplicitExpandableListField, SkippableField, UriField
from .models import Owner
from .mo... | {
"repo_name": "shosca/django-rest-witchcraft",
"path": "tests/test_fields.py",
"copies": "1",
"size": "2413",
"license": "mit",
"hash": -4464883141790692400,
"line_mean": 37.9193548387,
"line_max": 114,
"alpha_frac": 0.706174886,
"autogenerated": false,
"ratio": 3.65052950075643,
"config_test":... |
from django.test import SimpleTestCase, override_settings, TestCase
import time
from dimagi.utils.decorators.memoized import memoized
from pillowtop.checkpoints.manager import PillowCheckpoint, get_or_create_checkpoint
from pillowtop.checkpoints.util import get_machine_id
from pillowtop.exceptions import PillowtopCheck... | {
"repo_name": "qedsoftware/commcare-hq",
"path": "corehq/ex-submodules/pillowtop/tests/test_checkpoints.py",
"copies": "1",
"size": "3591",
"license": "bsd-3-clause",
"hash": 4663214957687430000,
"line_mean": 38.9,
"line_max": 97,
"alpha_frac": 0.7048175996,
"autogenerated": false,
"ratio": 3.916... |
from django.test import SimpleTestCase
from ..utils import setup
class CommentSyntaxTests(SimpleTestCase):
@setup({'comment-syntax01': '{# this is hidden #}hello'})
def test_comment_syntax01(self):
output = self.engine.render_to_string('comment-syntax01')
self.assertEqual(output, '... | {
"repo_name": "yephper/django",
"path": "tests/template_tests/syntax_tests/test_comment.py",
"copies": "1",
"size": "3759",
"license": "bsd-3-clause",
"hash": 3633807254648980000,
"line_mean": 38.8586956522,
"line_max": 86,
"alpha_frac": 0.6054801809,
"autogenerated": false,
"ratio": 3.6530612244... |
from django.test import SimpleTestCase
from ..utils import setup
class IfEqualTagTests(SimpleTestCase):
@setup({'ifequal01': '{% ifequal a b %}yes{% endifequal %}'})
def test_ifequal01(self):
output = self.engine.render_to_string('ifequal01', {'a': 1, 'b': 2})
self.assertEqual(outp... | {
"repo_name": "yephper/django",
"path": "tests/template_tests/syntax_tests/test_if_equal.py",
"copies": "1",
"size": "10109",
"license": "bsd-3-clause",
"hash": -2107403008963678700,
"line_mean": 44.5852534562,
"line_max": 98,
"alpha_frac": 0.5903650213,
"autogenerated": false,
"ratio": 3.2928338... |
from django.test import SimpleTestCase, TestCase
from corehq.apps.groups.tests.test_groups import WrapGroupTestMixin
from corehq.apps.products.models import Product, SQLProduct
class WrapProductTest(WrapGroupTestMixin, SimpleTestCase):
document_class = Product
class TestActiveProductManager(TestCase):
def ... | {
"repo_name": "qedsoftware/commcare-hq",
"path": "corehq/apps/products/tests/test_products.py",
"copies": "1",
"size": "1055",
"license": "bsd-3-clause",
"hash": -8096216164763766000,
"line_mean": 44.8695652174,
"line_max": 112,
"alpha_frac": 0.7279620853,
"autogenerated": false,
"ratio": 3.76785... |
from django.test import SimpleTestCase, TestCase
from corehq.apps.reports.filters.api import paginate_options
from corehq.apps.reports.filters.forms import FormsByApplicationFilterParams, FormsByApplicationFilter, \
PARAM_SLUG_STATUS, PARAM_VALUE_STATUS_ACTIVE, PARAM_SLUG_APP_ID, PARAM_SLUG_MODULE
from corehq.apps.... | {
"repo_name": "qedsoftware/commcare-hq",
"path": "corehq/apps/reports/tests/test_filters.py",
"copies": "1",
"size": "4319",
"license": "bsd-3-clause",
"hash": 5129175546318805000,
"line_mean": 38.2636363636,
"line_max": 105,
"alpha_frac": 0.6302384811,
"autogenerated": false,
"ratio": 3.59616985... |
from django.test import SimpleTestCase, TestCase
from django.conf import settings
from django.contrib.auth.models import User
from mock import patch
from .forms import ProjectForm
from .models import Project
class ProjectFormTest(SimpleTestCase):
def test_repo_url_validation(self):
# Valid repo url
... | {
"repo_name": "dmrz/gitality",
"path": "gitality/projects/tests.py",
"copies": "1",
"size": "1439",
"license": "mit",
"hash": 5845385030485416000,
"line_mean": 30.9777777778,
"line_max": 98,
"alpha_frac": 0.637248089,
"autogenerated": false,
"ratio": 3.6615776081424936,
"config_test": true,
"... |
from django.test import SimpleTestCase, TestCase
from parameterized import parameterized
from pyparsing import ParseException
from elasticsearch_dsl import Q
from elasticsearch_dsl.query import SimpleQueryString as S, Bool as B
from kitsune.search.parser import Parser
class ElasticQueryContainsMixin(object):
def... | {
"repo_name": "mozilla/kitsune",
"path": "kitsune/search/tests/test_parser.py",
"copies": "1",
"size": "6730",
"license": "bsd-3-clause",
"hash": 2864598992901188600,
"line_mean": 38.7278106509,
"line_max": 99,
"alpha_frac": 0.5153410783,
"autogenerated": false,
"ratio": 3.609677419354839,
"con... |
from django.test import SimpleTestCase, TestCase
from jsonobject.exceptions import BadValueError
from corehq.apps.domain.models import Domain
from corehq.apps.userreports.dbaccessors import get_all_report_configs, \
delete_all_report_configs
from corehq.apps.userreports.exceptions import BadSpecError
from corehq.... | {
"repo_name": "qedsoftware/commcare-hq",
"path": "corehq/apps/userreports/tests/test_report_config.py",
"copies": "1",
"size": "8140",
"license": "bsd-3-clause",
"hash": 2172415407594315000,
"line_mean": 33.0585774059,
"line_max": 87,
"alpha_frac": 0.5616707617,
"autogenerated": false,
"ratio": 4... |
from django.test import SimpleTestCase, TestCase
from ..model_generator import get_valid_article_chain
from ddcz.models import Author, Quest
class TestAuthorLinkRender(SimpleTestCase):
def setUp(self):
super().setUp()
data = get_valid_article_chain()
self.user = data["user"]
se... | {
"repo_name": "dracidoupe/graveyard",
"path": "ddcz/tests/test_models/test_author.py",
"copies": "1",
"size": "2484",
"license": "mit",
"hash": -211850174047771460,
"line_mean": 28.9277108434,
"line_max": 83,
"alpha_frac": 0.6360708535,
"autogenerated": false,
"ratio": 3.707462686567164,
"confi... |
from django.test import TestCase as BaseTestCase
from django.test.client import Client as BaseClient, RequestFactory
from django.contrib.auth.models import User
from django.template import RequestContext, loader
from music.models import Track
from chart.models import Chart, ChartEntry
class TestCase(BaseTestCase):
... | {
"repo_name": "praekelt/jmbo-chart",
"path": "chart/tests/__init__.py",
"copies": "1",
"size": "1585",
"license": "bsd-3-clause",
"hash": -8221837280083755000,
"line_mean": 35.0227272727,
"line_max": 92,
"alpha_frac": 0.6511041009,
"autogenerated": false,
"ratio": 4.053708439897698,
"config_tes... |
from django.test import TestCase as DjangoTestCase
from django.contrib.auth.models import User, AnonymousUser
from knowledge.models import Question, Response
class TestCase(DjangoTestCase):
def setUp(self):
self.admin = User.objects.create_superuser('admin', 'admin@example.com', 'secret')
self.jo... | {
"repo_name": "zapier/django-knowledge",
"path": "tests/mock/tests/base.py",
"copies": "6",
"size": "1120",
"license": "isc",
"hash": -3843757970725419000,
"line_mean": 36.3666666667,
"line_max": 98,
"alpha_frac": 0.6125,
"autogenerated": false,
"ratio": 3.902439024390244,
"config_test": false,... |
from django.test import TestCase as DjangoTestCase
from rest_framework.test import APIClient
from player.models import Room, Events
import sure
from datetime import datetime
class TestCase(DjangoTestCase):
def reload(self, item):
"""
Reload an item from DB
"""
return item.__class_... | {
"repo_name": "Amoki/Amoki-Music",
"path": "utils/testcase.py",
"copies": "1",
"size": "2228",
"license": "mit",
"hash": 3680456021093203500,
"line_mean": 38.0877192982,
"line_max": 104,
"alpha_frac": 0.6454219031,
"autogenerated": false,
"ratio": 3.6948590381426203,
"config_test": true,
"has... |
from django.test import TestCase as DjTestCase
"""
Based on http://stackoverflow.com/questions/2897609/#4934325
"""
class TestCase(DjTestCase):
def assertMessageCount(self, response, expect_num):
"""
Asserts that exactly the given number of messages have been sent.
"""
actual_num = len(response.context['mes... | {
"repo_name": "chaosk/trinitee",
"path": "trinitee/lib/unittest.py",
"copies": "1",
"size": "1028",
"license": "bsd-3-clause",
"hash": 282740438497537820,
"line_mean": 29.2352941176,
"line_max": 67,
"alpha_frac": 0.6721789883,
"autogenerated": false,
"ratio": 3.2843450479233227,
"config_test": ... |
from django.test import TestCase as _TestCase
from django.test.runner import DiscoverRunner
class OpenSlidesDiscoverRunner(DiscoverRunner):
def run_tests(self, test_labels, extra_tests=None, **kwargs):
"""
Test Runner which does not create a database, if only unittest are run.
"""
... | {
"repo_name": "rolandgeider/OpenSlides",
"path": "openslides/utils/test.py",
"copies": "1",
"size": "1092",
"license": "mit",
"hash": 3351695323071338500,
"line_mean": 32.0909090909,
"line_max": 79,
"alpha_frac": 0.641025641,
"autogenerated": false,
"ratio": 4.183908045977011,
"config_test": tr... |
from django.test import TestCase, Client
from author.models import Author, Follow
from django.contrib.auth.models import User
# Create your tests here.
class AuthorTestCase(TestCase):
def setUp(self):
User.objects.create(username="Bill", email="bill@nye.com", password="test")
User.objects.create(u... | {
"repo_name": "md6113/404cmputProject",
"path": "social/author/tests.py",
"copies": "1",
"size": "5901",
"license": "apache-2.0",
"hash": 4498856287587721700,
"line_mean": 37.0709677419,
"line_max": 94,
"alpha_frac": 0.6609049314,
"autogenerated": false,
"ratio": 3.5698729582577133,
"config_tes... |
from django.test import TestCase, Client
from binder.json import jsonloads
from django.contrib.auth.models import User
from ..testapp.models import Zoo
class DateFiltersTest(TestCase):
def setUp(self):
super().setUp()
u = User(username='testuser', is_active=True, is_superuser=True)
u.set_password('test')
u.s... | {
"repo_name": "CodeYellowBV/django-binder",
"path": "tests/filters/test_date_filters.py",
"copies": "1",
"size": "3709",
"license": "mit",
"hash": 471436570287278000,
"line_mean": 35.362745098,
"line_max": 109,
"alpha_frac": 0.6883256943,
"autogenerated": false,
"ratio": 2.979116465863454,
"con... |
from django.test import TestCase, Client
from bookstore.models import Book, Category
from django.core.urlresolvers import reverse
class BookStoreViewTestCase(TestCase):
def setUp(self):
self.client = Client()
self.category = Category.objects.create(name="programming", description="for the geeks")
... | {
"repo_name": "andela-ijubril/book-search",
"path": "booker/bookstore/tests/test_views.py",
"copies": "1",
"size": "1271",
"license": "mit",
"hash": 1424514648406520600,
"line_mean": 35.3142857143,
"line_max": 127,
"alpha_frac": 0.6719118804,
"autogenerated": false,
"ratio": 3.99685534591195,
"... |
from django.test import TestCase, Client
from bs4 import BeautifulSoup
from django.core import mail
from django.contrib.auth.models import User
import factory
class UserFactory(factory.Factory):
class Meta:
model = User
username = 'testsubject1'
first_name = 'Chell'
last_name = '[REDACTED]'
... | {
"repo_name": "gatita/django-imager",
"path": "imagersite/imagersite/tests.py",
"copies": "1",
"size": "3534",
"license": "mit",
"hash": -7494864040410964000,
"line_mean": 30.8378378378,
"line_max": 71,
"alpha_frac": 0.5789473684,
"autogenerated": false,
"ratio": 4.1723730814639906,
"config_tes... |
from django.test import TestCase, Client
from django.conf import settings as django_settings
from django.test.utils import ContextList
from django.test.signals import template_rendered
from django import template
from django.db.models.signals import pre_save
from django.contrib import admin
from django.contrib.auth.mo... | {
"repo_name": "carljm/django-adminfiles",
"path": "tests/tests.py",
"copies": "1",
"size": "13254",
"license": "bsd-3-clause",
"hash": 4344175865886220300,
"line_mean": 37.8680351906,
"line_max": 92,
"alpha_frac": 0.6173230723,
"autogenerated": false,
"ratio": 3.9825721153846154,
"config_test":... |
from django.test import TestCase, Client
from django.conf import settings
from datetime import datetime
from pytz import UTC
from dj_twilio_sms import utils
from dj_twilio_sms.models import OutgoingSMS
class SmsSendingTest(TestCase):
def test_send_sms(self):
result = utils.send_sms(
request=No... | {
"repo_name": "mastizada/dj-twilio-sms",
"path": "dj_twilio_sms/tests.py",
"copies": "1",
"size": "1727",
"license": "mit",
"hash": -6665303040078709000,
"line_mean": 40.119047619,
"line_max": 87,
"alpha_frac": 0.6409959467,
"autogenerated": false,
"ratio": 3.488888888888889,
"config_test": tru... |
from django.test import TestCase, Client
from django.conf import settings
from django.contrib.auth.models import User
from rest_framework.reverse import reverse
from tokenauth.authbackends import TokenAuthBackend
import requests
import responses
## Here's some example test code to get you started ..
def mock_auth... | {
"repo_name": "TangentMicroServices/PyMicroUtils",
"path": "fabness/templates/tests.py",
"copies": "3",
"size": "1033",
"license": "mit",
"hash": 4725731552332223000,
"line_mean": 26.1842105263,
"line_max": 71,
"alpha_frac": 0.7057115198,
"autogenerated": false,
"ratio": 3.466442953020134,
"con... |
from django.test import TestCase, Client
from django.conf import settings
from django.core import mail
from .models import *
class Reactions(TestCase):
def setUp(self):
self.client = Client()
self.u = User.objects.create(username="test")
ne = NotificationEmail.objects.create(user=self.u,... | {
"repo_name": "bebosudo/sest",
"path": "web/sest/tests_reactions.py",
"copies": "1",
"size": "3797",
"license": "mit",
"hash": 8729487365224414000,
"line_mean": 38.5520833333,
"line_max": 73,
"alpha_frac": 0.4527258362,
"autogenerated": false,
"ratio": 4.558223289315726,
"config_test": true,
... |
from django.test import TestCase, Client
from django.conf import settings
class ViewsTestCase(TestCase):
def setUp(self):
self.client = Client()
def tearDown(self):
settings.SHOPIFY_APP_DEV_MODE = False
self.client = None
def test_login_view(self):
"""
Test the l... | {
"repo_name": "discolabs/django-shopify-auth",
"path": "shopify_auth/tests/test_views.py",
"copies": "1",
"size": "2636",
"license": "mit",
"hash": 1646576185067846100,
"line_mean": 40.8571428571,
"line_max": 117,
"alpha_frac": 0.6657814871,
"autogenerated": false,
"ratio": 3.865102639296188,
"... |
from django.test import TestCase, Client
from django.contrib.auth.models import User, AnonymousUser
from django.core.urlresolvers import reverse
from django.db import DatabaseError
import json
from mock import patch
from rest_framework.test import APIClient
class HealthTestCase(TestCase):
def setUp(self):
... | {
"repo_name": "TangentSolutions/DRF-seed",
"path": "ansibles/templates/tests.py",
"copies": "1",
"size": "10324",
"license": "mit",
"hash": 31800034017389764,
"line_mean": 33.4133333333,
"line_max": 121,
"alpha_frac": 0.5916311507,
"autogenerated": false,
"ratio": 3.8336427775714816,
"config_te... |
from django.test import TestCase, Client
from django.contrib.auth.models import User
from author.models import Follow, Author
from post.models import Post
from urllib import request
import base64, mimetypes
# Create your tests here.
class PrivacyTestCase(TestCase):
def setUp(self):
self.author_user = Use... | {
"repo_name": "md6113/404cmputProject",
"path": "social/post/tests.py",
"copies": "1",
"size": "8030",
"license": "apache-2.0",
"hash": -3900629821866930700,
"line_mean": 39.15,
"line_max": 141,
"alpha_frac": 0.6542963885,
"autogenerated": false,
"ratio": 3.771723813997182,
"config_test": true,... |
from django.test import TestCase, Client
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from views import do_search
from models import create_initial_db, create_initial_es
class SearchTest(TestCase):
def setUp(self):
create_initial_db()
create_initial_es()... | {
"repo_name": "scoursen/elasticsearch-entitlements-webinar",
"path": "webinar/entitlements/tests.py",
"copies": "1",
"size": "3317",
"license": "mit",
"hash": -1373354185003878000,
"line_mean": 29.1545454545,
"line_max": 103,
"alpha_frac": 0.5978293639,
"autogenerated": false,
"ratio": 4.00120627... |
from django.test import TestCase, Client
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from .models import Language, Category, BookDetail, BookCopy, Periodical, PeriodicalIssue
class ItemsTestCase(TestCase):
def setUp(self):
self.staff_user = User.objects.create... | {
"repo_name": "tony-joseph/livre",
"path": "items/tests.py",
"copies": "1",
"size": "1964",
"license": "bsd-3-clause",
"hash": -8266879932278711000,
"line_mean": 35.3703703704,
"line_max": 113,
"alpha_frac": 0.6283095723,
"autogenerated": false,
"ratio": 4.1002087682672235,
"config_test": true,... |
from django.test import TestCase, Client
from django.contrib.auth.models import User
from django.utils.dateparse import parse_datetime
from binder.json import jsonloads, jsondumps
from .testapp.models import Caretaker
class TestFieldBlocking(TestCase):
"""
Check that unwritable_fields and unupdatable_fields work as... | {
"repo_name": "CodeYellowBV/django-binder",
"path": "tests/test_field_blocking.py",
"copies": "1",
"size": "4351",
"license": "mit",
"hash": -3360461020169260000,
"line_mean": 38.1981981982,
"line_max": 165,
"alpha_frac": 0.7143185475,
"autogenerated": false,
"ratio": 2.9638964577656677,
"confi... |
from django.test import TestCase, Client
from django.contrib.auth.models import User
from pairprogram.models import Session
class TestPairProgram(TestCase):
def setUp(self):
self.user = User.objects.create(
username="regularjoe",
email="regularjoe@yahoo.com",
... | {
"repo_name": "andela/codango",
"path": "codango/pairprogram/tests/test_models.py",
"copies": "1",
"size": "1568",
"license": "mit",
"hash": 6498582093872018000,
"line_mean": 39.2051282051,
"line_max": 78,
"alpha_frac": 0.6568877551,
"autogenerated": false,
"ratio": 4.192513368983957,
"config_t... |
from django.test import TestCase, Client
from django.contrib.auth.models import User
from rest_framework.authtoken.models import Token
from rest_framework import status
from nose.tools import assert_equals, assert_true, assert_false, assert_is_not_none
import json
class LoginTest(TestCase):
def setUp(self):
... | {
"repo_name": "SanaMobile/sana.protocol_builder",
"path": "src-django/authentication/tests/test_login.py",
"copies": "1",
"size": "1571",
"license": "bsd-3-clause",
"hash": 3528816725062673400,
"line_mean": 35.5348837209,
"line_max": 96,
"alpha_frac": 0.6518141311,
"autogenerated": false,
"ratio"... |
from django.test import TestCase, Client
from django.contrib.auth.models import User
from unittest import mock
from binder.views import JsonResponse
from .testapp.urls import room_controller
from .testapp.models import Animal, Costume
import requests
import json
from django.test import override_settings
class MockUse... | {
"repo_name": "CodeYellowBV/django-binder",
"path": "tests/test_websocket.py",
"copies": "1",
"size": "1800",
"license": "mit",
"hash": -8792441321507517000,
"line_mean": 24.7142857143,
"line_max": 83,
"alpha_frac": 0.7011111111,
"autogenerated": false,
"ratio": 2.9459901800327333,
"config_test... |
from django.test import TestCase, Client
from django.contrib.auth.models import User
from unittest.mock import Mock
from yacon import decorators
from yacon.tests.utils import create_test_site
# ============================================================================
@decorators.superuser_required
def superuser_v... | {
"repo_name": "cltrudeau/django-yacon",
"path": "yacon/tests/test_decorators.py",
"copies": "1",
"size": "1065",
"license": "mit",
"hash": -135605579651263440,
"line_mean": 31.2727272727,
"line_max": 78,
"alpha_frac": 0.5915492958,
"autogenerated": false,
"ratio": 4.650655021834061,
"config_tes... |
from django.test import TestCase, Client
from django.contrib.auth.models import User
from binder.json import jsonloads
from .compare import assert_json, EXTRA
from .testapp.models import Zoo, Animal, ContactPerson
class TestFilterManyRels(TestCase):
def setUp(self):
super().setUp()
u = User(username='testuser... | {
"repo_name": "CodeYellowBV/django-binder",
"path": "tests/test_filter_manyrels.py",
"copies": "1",
"size": "5124",
"license": "mit",
"hash": -68022826419771760,
"line_mean": 22.397260274,
"line_max": 82,
"alpha_frac": 0.6100702576,
"autogenerated": false,
"ratio": 2.8325041459369817,
"config_t... |
from django.test import TestCase, Client
from django.contrib.sites.models import Site
from website.models import Wedding
from events.models import Event
from events.helpers import EventsMockDataHelper
from guests.models import *
from guests.helpers import EmailHelper
from django.core import mail
import unittest
class... | {
"repo_name": "toast38coza/WeddingSite",
"path": "guests/tests.py",
"copies": "1",
"size": "1640",
"license": "mit",
"hash": -6529353361693651000,
"line_mean": 27.7894736842,
"line_max": 140,
"alpha_frac": 0.6963414634,
"autogenerated": false,
"ratio": 2.857142857142857,
"config_test": true,
... |
from django.test import TestCase, Client
from django.core.exceptions import ObjectDoesNotExist
import json
from ...models import Country, City, University
class UniversityViewTestCase(TestCase):
def test_post(self):
country1 = Country.objects.create(name='Italy')
city1 = City.objects.create(name='... | {
"repo_name": "CSyllabus/webapp",
"path": "backend/apps/csyllabusapi/views/tests/test_university.py",
"copies": "1",
"size": "2937",
"license": "mit",
"hash": -4606304243458723300,
"line_mean": 39.8055555556,
"line_max": 115,
"alpha_frac": 0.6084439905,
"autogenerated": false,
"ratio": 3.82421875... |
from django.test import TestCase, client
from django.core import mail
from django.utils.html import strip_tags
from django.template.loader import render_to_string
from django.contrib.auth.models import User, Group
from django.contrib.gis.geos.geometry import GEOSGeometry
from user_control.models import NewUserForm, Use... | {
"repo_name": "spatialcollective/watsan",
"path": "user_control/tests/testSignUpFunctions.py",
"copies": "1",
"size": "2163",
"license": "mit",
"hash": -4304460159531236000,
"line_mean": 48.1590909091,
"line_max": 145,
"alpha_frac": 0.752196024,
"autogenerated": false,
"ratio": 3.444267515923567,... |
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
from blog.models import Post, Category, Tag, Comment
class Test(TestCase):
def test_category(self):
category = Category.objects.create(
name='test cat', slug='cat_slug')
category.save()
respo... | {
"repo_name": "evg-dev/pyblog",
"path": "blog/tests.py",
"copies": "1",
"size": "5205",
"license": "mit",
"hash": 621104236866713700,
"line_mean": 31.3291925466,
"line_max": 66,
"alpha_frac": 0.5467819404,
"autogenerated": false,
"ratio": 4.069585613760751,
"config_test": true,
"has_no_keywor... |
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
from dashboard.forms import BucketListForm
from dashboard.views import BucketListCreateView,\
BucketListUpdateView
class BucketListsTestCase(TestCase):
"""
Testcase for the Home/Authentication Vie... | {
"repo_name": "andela-uawili/django-bucketlist-application",
"path": "bucketlist/tests/dashboard/test_views_bucketlists.py",
"copies": "1",
"size": "6957",
"license": "mit",
"hash": -1379479418111454000,
"line_mean": 38.0842696629,
"line_max": 75,
"alpha_frac": 0.6172200661,
"autogenerated": false,... |
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User, Group
class ContactForm(TestCase):
"""
Test Calls fot all method related with the complete videos interface
"""
fixtures = ['initial_data']
def setUp(self):
... | {
"repo_name": "foraliving/pilot",
"path": "foraliving/tests/test_contact_form.py",
"copies": "1",
"size": "2261",
"license": "mit",
"hash": -3937600774349901000,
"line_mean": 32.7462686567,
"line_max": 147,
"alpha_frac": 0.5696594427,
"autogenerated": false,
"ratio": 4.118397085610201,
"config_... |
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from foraliving.models import Video, Interview_Question_Map, Interview, Question, \
Interview_Question_Video_Map, User_Add_Ons
class VideosPage(TestCase):
"""
Test Calls fo... | {
"repo_name": "foraliving/pilot",
"path": "foraliving/tests/test_videos_page.py",
"copies": "1",
"size": "4967",
"license": "mit",
"hash": -6704910675885080000,
"line_mean": 42.1913043478,
"line_max": 136,
"alpha_frac": 0.6551238172,
"autogenerated": false,
"ratio": 3.8003060443764345,
"config_... |
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.core import mail
from django.conf import settings
from model_mommy import mommy
from vwcurriculum.core.models import Profile
class ContactTestCase(TestCase):
def setUp(self):
pr... | {
"repo_name": "VWApplications/VWCurriculum",
"path": "vwcurriculum/core/tests/test_forms.py",
"copies": "1",
"size": "1235",
"license": "mpl-2.0",
"hash": 4523387982204987400,
"line_mean": 39.9666666667,
"line_max": 95,
"alpha_frac": 0.7054515867,
"autogenerated": false,
"ratio": 3.27733333333333... |
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
# from django.core.exceptions import ValidationError
from django.utils import six
from django.utils.translation import ugettext as _
from django.contrib.auth.models import User
from deck.tests.test_unit import EVENT_DATA
from deck.mo... | {
"repo_name": "luanfonceca/speakerfight",
"path": "jury/tests/test_functional.py",
"copies": "2",
"size": "3793",
"license": "mit",
"hash": -1251565849452895000,
"line_mean": 45.8271604938,
"line_max": 78,
"alpha_frac": 0.5670972845,
"autogenerated": false,
"ratio": 4.131808278867102,
"config_t... |
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
from django.core.files import File
import PIL
from PIL import Image
from mock import patch, MagicMock
from webapp.forms import PhotoForm
class DashboardTestCase(TestCase):
"""
Testcase for the Dashboard View .
"""
... | {
"repo_name": "andela-uawili/photo-editing-application",
"path": "neatpix/webapp/tests/test_dashboard.py",
"copies": "1",
"size": "6774",
"license": "mit",
"hash": 6968259653000729000,
"line_mean": 31.5673076923,
"line_max": 75,
"alpha_frac": 0.5590493062,
"autogenerated": false,
"ratio": 4.20745... |
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.contrib.auth.models import User
from deals.models import Deal
from deals.tests.test_routes import set_advertiser_and_category
class AddToCartRouteTestCase(TestCase):
"""Te... | {
"repo_name": "andela/troupon",
"path": "troupon/cart/tests/test_routes.py",
"copies": "1",
"size": "2815",
"license": "mit",
"hash": -4889936591208343000,
"line_mean": 25.5566037736,
"line_max": 67,
"alpha_frac": 0.61669627,
"autogenerated": false,
"ratio": 4.056195965417867,
"config_test": tr... |
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
from django.template.defaultfilters import slugify
from deals.models import Deal, Advertiser, Category
from deals.views import HomePageView, DealsView,\
FilteredDealsView
def set_advertiser_and_category():
"""Sets the adver... | {
"repo_name": "andela/troupon",
"path": "troupon/deals/tests/test_routes.py",
"copies": "1",
"size": "4596",
"license": "mit",
"hash": -4902464275103068000,
"line_mean": 29.64,
"line_max": 66,
"alpha_frac": 0.5881201044,
"autogenerated": false,
"ratio": 3.948453608247423,
"config_test": true,
... |
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
from councilmatic_core.models import Organization, Person
from nyc.models import NYCBill
class BillDetailViewTests(TestCase):
fixtures = ['nyc_sessions.json', 'nyc_orgs.json', 'nyc_bills.json']
def test_do_redirect(self):
... | {
"repo_name": "datamade/nyc-councilmatic",
"path": "nyc/tests/tests.py",
"copies": "1",
"size": "1546",
"license": "mit",
"hash": 7097964774470442000,
"line_mean": 30.5510204082,
"line_max": 84,
"alpha_frac": 0.6403622251,
"autogenerated": false,
"ratio": 3.8844221105527637,
"config_test": true... |
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
class IndexTestCase(TestCase):
"""
Testcase for the Index View .
"""
fixtures = ['sample_data.json']
def setUp(self):
"""
operations to be done before every test
"""
# create a te... | {
"repo_name": "andela-uawili/photo-editing-application",
"path": "neatpix/webapp/tests/test_index_auth.py",
"copies": "1",
"size": "4369",
"license": "mit",
"hash": 288020682756334370,
"line_mean": 31.362962963,
"line_max": 76,
"alpha_frac": 0.5062943465,
"autogenerated": false,
"ratio": 4.404233... |
from django.test import TestCase, Client
from django.http import HttpRequest, Http404
from wagtail.wagtailcore.models import Page, Site
from wagtail.tests.models import EventPage
class TestRouting(TestCase):
fixtures = ['test.json']
def test_find_site_for_request(self):
default_site = Site.objects.... | {
"repo_name": "suziesparkle/wagtail",
"path": "wagtail/wagtailcore/tests.py",
"copies": "1",
"size": "6203",
"license": "bsd-3-clause",
"hash": -5953633876956021000,
"line_mean": 43.3071428571,
"line_max": 107,
"alpha_frac": 0.6674189908,
"autogenerated": false,
"ratio": 3.848014888337469,
"con... |
from django.test import TestCase, Client
from django.http import HttpResponse
from django.core.urlresolvers import reverse
from django.conf.urls import patterns, url, include
from django.contrib.auth import get_user_model
from rest_framework import permissions
from rest_framework.views import APIView
from oauth2_provi... | {
"repo_name": "burnash/NeuroVault",
"path": "neurovault/apps/users/tests/test_oauth.py",
"copies": "4",
"size": "2268",
"license": "mit",
"hash": 764048518316129000,
"line_mean": 32.3529411765,
"line_max": 76,
"alpha_frac": 0.6693121693,
"autogenerated": false,
"ratio": 3.8505942275042444,
"con... |
from django.test import TestCase, Client
from django.http import JsonResponse
import json
class Login(TestCase):
def test_sign_in_ok(self):
c = Client()
response = c.post('/sign_in/', {'data': '{"p_username": "admin", "p_pwd": "admin"}'})
assert 200 == response.status_code
data = j... | {
"repo_name": "rafaelthca/OmniDB",
"path": "OmniDB/OmniDB_app/tests/bak_test_views.py",
"copies": "3",
"size": "7338",
"license": "mit",
"hash": 4190185572956964400,
"line_mean": 33.4507042254,
"line_max": 93,
"alpha_frac": 0.5906241483,
"autogenerated": false,
"ratio": 3.8001035732780943,
"con... |
from django.test import TestCase, Client
from django.http import JsonResponse
import json
from datetime import datetime, timedelta
import OmniDB_app.include.Spartacus as Spartacus
import OmniDB_app.include.Spartacus.Database as Database
import OmniDB_app.include.Spartacus.Utils as Utils
import OmniDB_app.include.Omni... | {
"repo_name": "rafaelthca/OmniDB",
"path": "OmniDB/OmniDB_app/tests/test_postgresql95.py",
"copies": "3",
"size": "87903",
"license": "mit",
"hash": -1084329668899118300,
"line_mean": 48.9732802729,
"line_max": 622,
"alpha_frac": 0.6395344869,
"autogenerated": false,
"ratio": 3.4797909821463917,
... |
from django.test import TestCase, Client
from django.template import Template, Context
from django.core.urlresolvers import reverse
from ssi.utils import generate_ssi_cache_key
class SSITestCase(TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_ssi_template_r... | {
"repo_name": "smn/django-nginx-ssi",
"path": "src/ssi/tests.py",
"copies": "1",
"size": "1126",
"license": "bsd-3-clause",
"hash": -8924126679560366000,
"line_mean": 35.3225806452,
"line_max": 85,
"alpha_frac": 0.5941385435,
"autogenerated": false,
"ratio": 3.937062937062937,
"config_test": fa... |
from django.test import TestCase, Client
from django.test.client import RequestFactory
from django.core.urlresolvers import reverse
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
from admin_extras.admin import ReadOnlyMixin
from .utils import (
create_staff_user,
create_... | {
"repo_name": "MichalMaM/django-admin-extras",
"path": "tests/test_admin.py",
"copies": "1",
"size": "8972",
"license": "bsd-2-clause",
"hash": -8481837305480550000,
"line_mean": 44.7755102041,
"line_max": 101,
"alpha_frac": 0.6509139545,
"autogenerated": false,
"ratio": 3.6710310965630115,
"co... |
from django.test import TestCase, Client
from django.test.utils import override_settings
from .common.db import create_dummy_models
class APITest(TestCase):
# TODO: Add more methods to test returned API values. Will likely require a
# more elaborate data set to test from. Maybe freeze a copy of the database
... | {
"repo_name": "xgi/aliendb",
"path": "web/aliendb/apps/analytics/tests/test_api.py",
"copies": "1",
"size": "1748",
"license": "bsd-3-clause",
"hash": -8803308334058793000,
"line_mean": 40.619047619,
"line_max": 79,
"alpha_frac": 0.6687643021,
"autogenerated": false,
"ratio": 3.7835497835497836,
... |
from django.test import TestCase, Client
from django.test.utils import override_settings
from django.core.cache import cache
from .common.db import create_dummy_models
@override_settings(DEBUG=False)
class CacheTest(TestCase):
def setUp(self):
self.client = Client()
create_dummy_models()
c... | {
"repo_name": "xgi/aliendb",
"path": "web/aliendb/apps/analytics/tests/test_cache.py",
"copies": "1",
"size": "1130",
"license": "bsd-3-clause",
"hash": -2362502394813301000,
"line_mean": 34.3125,
"line_max": 62,
"alpha_frac": 0.6867256637,
"autogenerated": false,
"ratio": 4.00709219858156,
"co... |
from django.test import TestCase, Client
from django.urls import reverse
from rest_framework import status
from .models import Lugares
from .serializers import *
import json
class LugaresTests(TestCase):
def setUp(self):
self.client = Client()
self.primer_lugar = Lugares.objects.create(
... | {
"repo_name": "ramrodo/devfbackend-api",
"path": "apiDamificados/lugares/tests.py",
"copies": "1",
"size": "1559",
"license": "mit",
"hash": 5322678887224992000,
"line_mean": 31.4791666667,
"line_max": 63,
"alpha_frac": 0.5856318153,
"autogenerated": false,
"ratio": 3.651053864168618,
"config_t... |
from django.test import TestCase, Client
from django.urls import reverse
from accounts.models import Account
class CoreTestCase(TestCase):
def setUp(self):
self.user = Account.objects.create_user('user', is_active=True)
self.client = Client()
def test_home_page(self):
"""Přihlášený ... | {
"repo_name": "bugulin/gymgeek-web",
"path": "core/tests.py",
"copies": "1",
"size": "1914",
"license": "apache-2.0",
"hash": -8051470614803822000,
"line_mean": 37.3469387755,
"line_max": 152,
"alpha_frac": 0.6647152741,
"autogenerated": false,
"ratio": 3.3315602836879434,
"config_test": true,
... |
from django.test import TestCase, Client
from django.utils import timezone
# python stuf
import json
import os
import csv
# model
from timeperstreet.models import Tramos15Min, OrigenYDestinoEjes15Min
# views
from timeperstreet.views import GetStreetData, GetPOIData, StreetTimeMapHandler, GetStreetTableData, StreetTim... | {
"repo_name": "SmartcitySantiagoChile/onlineGPS",
"path": "timeperstreet/tests/tests.py",
"copies": "1",
"size": "5654",
"license": "mit",
"hash": -7538529426913109000,
"line_mean": 35.4774193548,
"line_max": 126,
"alpha_frac": 0.5038910506,
"autogenerated": false,
"ratio": 4.191252779836916,
"... |
from django.test import TestCase, Client
from .google_maps_distance_calc import GoogleDistanceCalc
class TestGoogleDistanceAPI(TestCase):
""" Test the google API. Requires internet access.
Some errors may occur if the max daily limit for the API key
or the IP address are hit (roughly 2000 requests per day... | {
"repo_name": "SandalsSoftware/django_maps_api",
"path": "test_google.py",
"copies": "1",
"size": "3224",
"license": "mit",
"hash": 3933273020522263600,
"line_mean": 46.4117647059,
"line_max": 98,
"alpha_frac": 0.6042183623,
"autogenerated": false,
"ratio": 4.10178117048346,
"config_test": true... |
from django.test import TestCase,Client
from httmock import urlmatch, response, HTTMock
import os
from django.contrib.auth.models import User
from django.template.defaultfilters import slugify
from .models import *
def register_valid_proxy(name,url,refresh=100):
p = SourceDocument.objects.create(Name=name,Source... | {
"repo_name": "ngageoint/geoq",
"path": "geoq/proxy/tests.py",
"copies": "1",
"size": "6015",
"license": "mit",
"hash": -1567299680008759300,
"line_mean": 44.5681818182,
"line_max": 159,
"alpha_frac": 0.6186201164,
"autogenerated": false,
"ratio": 3.6476652516676773,
"config_test": true,
"has... |
from django.test import TestCase, Client
from .. import FacultyView
from ...models import Country, City, University, Faculty
class FacultyViewTestCase(TestCase):
def test_get(self):
country1 = Country.objects.create(name='Croatia')
city1 = City.objects.create(name='Zagreb', country=country1)
... | {
"repo_name": "CSyllabus/webapp",
"path": "backend/apps/csyllabusapi/views/tests/test_faculties.py",
"copies": "1",
"size": "1207",
"license": "mit",
"hash": -4687013194729913000,
"line_mean": 47.32,
"line_max": 118,
"alpha_frac": 0.661971831,
"autogenerated": false,
"ratio": 3.831746031746032,
... |
from django.test import TestCase, Client
from models import BacklogItem
from backlogs.models import Backlog
from django.contrib.auth.models import AnonymousUser, User
from django.core.urlresolvers import reverse
# Create your tests here.
class BacklogItemViewTest(TestCase):
def setUp(self):
self.user = Use... | {
"repo_name": "anoncb1754/backlogr_py",
"path": "backlogr/backlog_items/tests.py",
"copies": "1",
"size": "4401",
"license": "unlicense",
"hash": -7447282927961407000,
"line_mean": 34.4919354839,
"line_max": 162,
"alpha_frac": 0.6216768916,
"autogenerated": false,
"ratio": 3.932975871313673,
"c... |
from django.test import TestCase, Client
from ...models import Country
from django.core.exceptions import ObjectDoesNotExist
import json
from django.utils import timezone
class CountryViewTestCase(TestCase):
def test_post(self):
country1 = Country.objects.create(name="Italy")
c = Client()
... | {
"repo_name": "CSyllabus/webapp",
"path": "backend/apps/csyllabusapi/views/tests/test_country.py",
"copies": "1",
"size": "1963",
"license": "mit",
"hash": 6217689419906817000,
"line_mean": 32.8620689655,
"line_max": 93,
"alpha_frac": 0.5797249109,
"autogenerated": false,
"ratio": 4.0726141078838... |
from django.test import TestCase, Client
from .models import *
# Create your tests here.
class RegisterTest(TestCase):
def setUp(self):
user = User.objects.create_user(username='test@test.test', password='test', email='test@test.test',)
def test_register_wrong_post_data(self):
c = Client()
... | {
"repo_name": "actofgoods/actofgoods",
"path": "basics/tests.py",
"copies": "1",
"size": "9880",
"license": "mit",
"hash": 4101128333459976700,
"line_mean": 52.4054054054,
"line_max": 183,
"alpha_frac": 0.6093117409,
"autogenerated": false,
"ratio": 3.4788732394366195,
"config_test": true,
"h... |
from django.test import TestCase, Client
from molo.core.models import SiteLanguageRelation, Languages, SectionIndexPage
from gem.tests.base import GemTestCaseMixin
class TestLanguageCodeSetting(TestCase, GemTestCaseMixin):
def setUp(self):
self.main = self.mk_main(
title='main1', slug='main1',... | {
"repo_name": "praekelt/molo-gem",
"path": "gem/tests/test_language.py",
"copies": "1",
"size": "1314",
"license": "bsd-2-clause",
"hash": -7007858867223055000,
"line_mean": 40.0625,
"line_max": 78,
"alpha_frac": 0.6514459665,
"autogenerated": false,
"ratio": 4.0430769230769235,
"config_test": ... |
from django.test import TestCase, Client
from openinghours.models import Company, OpeningHours, ClosingRules
from openinghours.forms import str_to_time
from datetime import datetime, timedelta
class OpeningHoursTestCase(TestCase):
"""Test some possible business scenarios."""
def setUp(self):
"""Create... | {
"repo_name": "arteria/django-openinghours",
"path": "openinghours/tests/tests.py",
"copies": "1",
"size": "1761",
"license": "mit",
"hash": -4693707283642863000,
"line_mean": 34.9387755102,
"line_max": 82,
"alpha_frac": 0.5207268597,
"autogenerated": false,
"ratio": 4.066974595842956,
"config_... |
from django.test import TestCase, Client
from organizations.models import Organization
# Create your tests here.
class ViewTests(TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_no_active_org(self):
c = Client()
c.post('/register/', {'username': 'aaa... | {
"repo_name": "amacnair/team-toolkit",
"path": "clubbr/dashboard/tests.py",
"copies": "1",
"size": "1807",
"license": "mit",
"hash": -1660236473928267800,
"line_mean": 49.1944444444,
"line_max": 154,
"alpha_frac": 0.6574432761,
"autogenerated": false,
"ratio": 4.0244988864142535,
"config_test":... |
from django.test import TestCase, Client
from rest_framework import status
from rest_framework.authtoken.models import Token
from api.startup import grant_permissions
from nose.tools import assert_equals, assert_true
from utils.helpers import add_token_to_header
from utils import factories
import json
class PageTest(... | {
"repo_name": "SanaMobile/sana.protocol_builder",
"path": "src-django/api/tests/test_pages.py",
"copies": "1",
"size": "3576",
"license": "bsd-3-clause",
"hash": 8312685284845777000,
"line_mean": 30.6460176991,
"line_max": 78,
"alpha_frac": 0.5321588367,
"autogenerated": false,
"ratio": 4,
"con... |
from django.test import TestCase, Client
from .testapp.models import Caretaker
from django.contrib.auth.models import User
from binder.json import jsonloads
class HiddenFieldTest(TestCase):
def setUp(self):
super().setUp()
u = User(username='testuser', is_active=True, is_superuser=True)
u.set_password('test')... | {
"repo_name": "CodeYellowBV/django-binder",
"path": "tests/test_hidden_fields.py",
"copies": "1",
"size": "2264",
"license": "mit",
"hash": 154823181955357100,
"line_mean": 27.3,
"line_max": 91,
"alpha_frac": 0.7000883392,
"autogenerated": false,
"ratio": 3.118457300275482,
"config_test": true,... |
from django.test import TestCase, Client
from vutman.models import EmailAlias, EmailUser, EmailDomain, EmailServer
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
class SimpleTestCase(TestCase):
def setUp(self):
self.client = Client()
self.request_user = Us... | {
"repo_name": "daniellawrence/django-vutman",
"path": "tests/test_view.py",
"copies": "1",
"size": "12291",
"license": "mit",
"hash": 4271892771407034000,
"line_mean": 39.0358306189,
"line_max": 79,
"alpha_frac": 0.566512082,
"autogenerated": false,
"ratio": 3.976383047557425,
"config_test": tr... |
from django.test import TestCase, Client
from webhook.models import IncomingRequest
from ifttt.helpers import IfThisThenThatHelpers
import responses, json, unittest
from mock import patch, ANY
class TestIFTTTViewSetPOST(TestCase):
@patch.object(IfThisThenThatHelpers, 'post_to_hipchat')
def test_create_ifttt_... | {
"repo_name": "TangentMicroServices/IncomingTransactionService",
"path": "ifttt/tests/test_api.py",
"copies": "1",
"size": "4943",
"license": "mit",
"hash": -8180242258361026000,
"line_mean": 35.0802919708,
"line_max": 130,
"alpha_frac": 0.5302447906,
"autogenerated": false,
"ratio": 3.7819433817... |
from django.test import TestCase, Client
from website.helpers.integrate import IntegrateTestCase
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.test import TestCase
# Create your tests here.
class ProcessesTestCase(TestCase):
USERNAME = 'napoli'
EMAIL = 'c... | {
"repo_name": "TCDocProc/arch",
"path": "app/openemr/tests.py",
"copies": "1",
"size": "1435",
"license": "mit",
"hash": 3530958445710921000,
"line_mean": 42.5151515152,
"line_max": 125,
"alpha_frac": 0.7017421603,
"autogenerated": false,
"ratio": 3.6889460154241647,
"config_test": true,
"has... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.