text stringlengths 0 1.05M | meta dict |
|---|---|
from django.test import TestCase
import json
import os
from decimal import Decimal
from autolims.autoprotocol_interpreter import execute_run
from autolims.models import (Organization, Project, Run,
Container,
User, Aliquot
)
from tra... | {
"repo_name": "scottbecker/autolims",
"path": "autolims/tests/test_autoprotocol_interpreter.py",
"copies": "1",
"size": "8197",
"license": "mit",
"hash": -2402729447737407000,
"line_mean": 41.6979166667,
"line_max": 113,
"alpha_frac": 0.5078687325,
"autogenerated": false,
"ratio": 4.9739077669902... |
from django.test import TestCase
import jsonschema
from .. import schemas
from jsonschema.exceptions import ValidationError
class TestValidation(TestCase):
def validator(self, data, schema_field):
"""
Perform validation and return a boolean indicating valid or not valid.
:data: Data to v... | {
"repo_name": "heytrav/drs-project",
"path": "domain_api/tests/test_json_validation.py",
"copies": "1",
"size": "3926",
"license": "mit",
"hash": -7039694281631004000,
"line_mean": 24.8289473684,
"line_max": 78,
"alpha_frac": 0.4582272033,
"autogenerated": false,
"ratio": 4.391498881431767,
"co... |
from django.test import TestCase
import logging
logger = logging.getLogger(__name__)
class MultinavigationTemplateTagDeepNestedTests(TestCase):
def setUp(self) -> None:
self.response = self.client.get('/a/b/c/d/')
self.url_match = self.response.resolver_match
def test_route(self):
se... | {
"repo_name": "adlh/django-multinavigation",
"path": "src/multinavigation/templatetags/test_deep_nested.py",
"copies": "1",
"size": "2230",
"license": "mit",
"hash": 3052056925522036000,
"line_mean": 29.5479452055,
"line_max": 105,
"alpha_frac": 0.4,
"autogenerated": false,
"ratio": 3.37878787878... |
from django.test import TestCase
import mock
from ..utils import tenant_url, tenant_name, tenant_site
def FixMock(**kwargs):
""" mock.Mock(name='x') == 'x' is False due to special 'name' behaviour """
m = mock.Mock(**kwargs)
if 'name' in kwargs:
m.name = kwargs['name']
return m
class TestTenan... | {
"repo_name": "jfterpstra/bluebottle",
"path": "bluebottle/clients/tests/test_sitereplacement.py",
"copies": "1",
"size": "1088",
"license": "bsd-3-clause",
"hash": -509224806932291500,
"line_mean": 37.8571428571,
"line_max": 79,
"alpha_frac": 0.6084558824,
"autogenerated": false,
"ratio": 3.8996... |
from django.test import TestCase
import mock
from cla_common.constants import REQUIRES_ACTION_BY
from core.tests.mommy_utils import make_recipe, make_user
from cla_eventlog.tests.test_forms import BaseCaseLogFormTestCaseMixin, EventSpecificLogFormTestCaseMixin
from diagnosis.models import DiagnosisTraversal
from l... | {
"repo_name": "ministryofjustice/cla_backend",
"path": "cla_backend/apps/cla_provider/tests/test_forms.py",
"copies": "1",
"size": "14208",
"license": "mit",
"hash": 486369130671756700,
"line_mean": 35.2448979592,
"line_max": 119,
"alpha_frac": 0.6094453829,
"autogenerated": false,
"ratio": 3.847... |
from django.test import TestCase
import mock
from django.conf import settings
from django.contrib.auth.models import User
from corehq.apps.users.models import CouchUser, CommCareUser
from corehq.apps.registration.utils import handle_changed_mailchimp_email
class UtilTestCase(TestCase):
def setUp(self):
... | {
"repo_name": "puttarajubr/commcare-hq",
"path": "corehq/apps/registration/tests/utils.py",
"copies": "1",
"size": "4411",
"license": "bsd-3-clause",
"hash": -890372605737404800,
"line_mean": 44.4742268041,
"line_max": 113,
"alpha_frac": 0.6953071866,
"autogenerated": false,
"ratio": 3.44609375,
... |
from django.test import TestCase
import mock
import uuid
from xml.etree import ElementTree
from corehq.apps.users.models import CommCareUser
from corehq.apps.hqcase.utils import submit_case_blocks
from casexml.apps.case.mock import CaseBlock
from casexml.apps.case.models import CommCareCase
from casexml.apps.case.test... | {
"repo_name": "puttarajubr/commcare-hq",
"path": "corehq/apps/users/tests/retire.py",
"copies": "1",
"size": "4320",
"license": "bsd-3-clause",
"hash": 7187465062899664000,
"line_mean": 35.3025210084,
"line_max": 94,
"alpha_frac": 0.6402777778,
"autogenerated": false,
"ratio": 3.467094703049759,
... |
from django.test import TestCase
import models
class AlbumAppModelTestCase(TestCase):
def testUser(self):
models.User.objects.create(name='jack',
pwdhash='fiddlefaddle',
email='jim@darkmagic.com')
models.User.objects.create(nam... | {
"repo_name": "sniboboof/djangophotos",
"path": "albumproject/albumapp/tests.py",
"copies": "1",
"size": "7608",
"license": "mit",
"hash": 3649175922538485000,
"line_mean": 50.0604026846,
"line_max": 79,
"alpha_frac": 0.5403522608,
"autogenerated": false,
"ratio": 4.4911452184179455,
"config_te... |
from django.test import TestCase
import mox
from affect.models import Criteria, Flag, datetime
class CriteriaModelTest(TestCase):
def test_unicode(self):
crit = Criteria.objects.create(name='test_crit')
self.assertEqual(unicode(crit), 'test_crit')
def test_save_updates_modified(self):
... | {
"repo_name": "ConsumerAffairs/django-affect",
"path": "affect/tests/model_tests.py",
"copies": "1",
"size": "1334",
"license": "bsd-3-clause",
"hash": -7373102662427252000,
"line_mean": 29.3181818182,
"line_max": 70,
"alpha_frac": 0.6394302849,
"autogenerated": false,
"ratio": 3.6448087431693987... |
from django.test import TestCase
import numpy as np
from analise import analyse as ana
from analise import analysisCaller as ac
class AnaliseTest(TestCase):
def setUp(self):
self.data = np.array([
[9,2,5,8],
[6,1,3,2],
[8,4,6,8],
[7,1,2,6],
[10,5... | {
"repo_name": "teamworkquality/twq-app",
"path": "api/analise/tests.py",
"copies": "1",
"size": "7038",
"license": "mit",
"hash": 6820532562531987000,
"line_mean": 42.4444444444,
"line_max": 112,
"alpha_frac": 0.5092355783,
"autogenerated": false,
"ratio": 3.11968085106383,
"config_test": true,... |
from django.test import TestCase
import os
from contento.backends.files import FlatFilesBackend
from contento.exceptions import CmsPageNotFound, CmsPageAlreadyExisting, FlatFilesBaseNotConfigured
from contento.settings import CONTENTO_FLATFILES_BASE
from contento.helpers import get_current_backend
import tempfile
impor... | {
"repo_name": "inmagik/contento",
"path": "tests/test_flatfile.py",
"copies": "1",
"size": "9063",
"license": "mit",
"hash": -7289710764314946000,
"line_mean": 33.2,
"line_max": 117,
"alpha_frac": 0.5826988856,
"autogenerated": false,
"ratio": 3.837002540220152,
"config_test": true,
"has_no_k... |
from django.test import TestCase
import os
from django.test.utils import override_settings
from casexml.apps.case.models import CommCareCase
from casexml.apps.case import process_cases
from casexml.apps.case.tests import delete_all_cases
from couchforms.util import post_xform_to_couch
@override_settings(CASEXML_FORCE... | {
"repo_name": "SEL-Columbia/commcare-hq",
"path": "corehq/ex-submodules/casexml/apps/case/tests/test_ota_restore.py",
"copies": "1",
"size": "1338",
"license": "bsd-3-clause",
"hash": -5345655024674819000,
"line_mean": 40.8125,
"line_max": 102,
"alpha_frac": 0.66367713,
"autogenerated": false,
"r... |
from django.test import TestCase
import os
from django.test.utils import override_settings
from casexml.apps.case.models import CommCareCase
from casexml.apps.case.tests import delete_all_xforms, delete_all_cases
from corehq.apps.hqcase.dbaccessors import get_case_ids_in_domain
from couchforms.tests.testutils import po... | {
"repo_name": "puttarajubr/commcare-hq",
"path": "corehq/ex-submodules/casexml/apps/case/tests/test_multi_case_submits.py",
"copies": "1",
"size": "2228",
"license": "bsd-3-clause",
"hash": -7981091158257163000,
"line_mean": 35.5245901639,
"line_max": 103,
"alpha_frac": 0.6211849192,
"autogenerated... |
from django.test import TestCase
import os
from django.test.utils import override_settings
from casexml.apps.case.models import CommCareCase
from casexml.apps.case.tests.util import delete_all_cases
from couchforms.tests.testutils import post_xform_to_couch
from casexml.apps.case.xform import process_cases
@override_... | {
"repo_name": "benrudolph/commcare-hq",
"path": "corehq/ex-submodules/casexml/apps/case/tests/test_exclusion.py",
"copies": "1",
"size": "1825",
"license": "bsd-3-clause",
"hash": 3174574643442978300,
"line_mean": 40.4772727273,
"line_max": 108,
"alpha_frac": 0.655890411,
"autogenerated": false,
... |
from django.test import TestCase
import os
from django.test.utils import override_settings
from casexml.apps.case.models import CommCareCase
from couchforms.tests.testutils import post_xform_to_couch
from casexml.apps.case.tests.util import check_xml_line_by_line, CaseBlock, delete_all_cases
from casexml.apps.case.xfor... | {
"repo_name": "benrudolph/commcare-hq",
"path": "corehq/ex-submodules/casexml/apps/case/tests/test_v2_parsing.py",
"copies": "1",
"size": "6705",
"license": "bsd-3-clause",
"hash": 2506010286307068000,
"line_mean": 40.90625,
"line_max": 145,
"alpha_frac": 0.6165548098,
"autogenerated": false,
"ra... |
from django.test import TestCase
import os
import json
from corehq.apps.app_manager.models import import_app
from corehq.apps.smsforms.app import start_session
from corehq.apps.smsforms.tests.util import MockContact, CONTACT_ID, q_and_a
from corehq.apps.smsforms.models import XFormsSession
from couchforms.models import... | {
"repo_name": "SEL-Columbia/commcare-hq",
"path": "corehq/apps/smsforms/tests/test_form_api.py",
"copies": "2",
"size": "4641",
"license": "bsd-3-clause",
"hash": -732069975797773000,
"line_mean": 44.5098039216,
"line_max": 95,
"alpha_frac": 0.5908209438,
"autogenerated": false,
"ratio": 4.039164... |
from django.test import TestCase
import os
import time
from django.test.utils import override_settings
from casexml.apps.phone.caselogic import BatchedCaseSyncOperation
from casexml.apps.phone.tests.utils import generate_restore_payload
from couchforms.tests.testutils import post_xform_to_couch
from casexml.apps.case.m... | {
"repo_name": "benrudolph/commcare-hq",
"path": "corehq/ex-submodules/casexml/apps/phone/tests/test_ota_restore.py",
"copies": "1",
"size": "10073",
"license": "bsd-3-clause",
"hash": 7886232234954557000,
"line_mean": 38.0426356589,
"line_max": 131,
"alpha_frac": 0.5919785565,
"autogenerated": fals... |
from django.test import TestCase
import os
import time
from django.test.utils import override_settings
from casexml.apps.phone.data_providers.case.batched import BatchedCaseSyncOperation
from casexml.apps.phone.tests.utils import generate_restore_payload
from couchforms.tests.testutils import post_xform_to_couch
from c... | {
"repo_name": "puttarajubr/commcare-hq",
"path": "corehq/ex-submodules/casexml/apps/phone/tests/test_ota_restore.py",
"copies": "1",
"size": "10910",
"license": "bsd-3-clause",
"hash": 1692357326479402000,
"line_mean": 37.6879432624,
"line_max": 138,
"alpha_frac": 0.580751604,
"autogenerated": fals... |
from django.test import TestCase
import pytest
from mittab.apps.tab.models import Team, Judge, Scratch
from mittab.libs.tests.data_import import MockWorkbook
from mittab.libs.data_import.import_scratches import ScratchImporter
@pytest.mark.django_db
class TestImportingScratches(TestCase):
pytestmark = pytest.mar... | {
"repo_name": "jolynch/mit-tab",
"path": "mittab/libs/tests/data_import/test_import_scratches.py",
"copies": "1",
"size": "2712",
"license": "mit",
"hash": -8245541277640400000,
"line_mean": 40.7230769231,
"line_max": 76,
"alpha_frac": 0.6323746313,
"autogenerated": false,
"ratio": 3.535853976531... |
from django.test import TestCase
import random
import logging
import ast
from datetime import datetime
import pytz
from bot.models import Account
from community.models import Community
from moderation.models import SocialUser, SocialMedia
from conversation.models import Tweetdj
from tagging.models import Queue, Proces... | {
"repo_name": "jeromecc/doctoctocbot",
"path": "src/tagging/tests/test_tasks.py",
"copies": "1",
"size": "3487",
"license": "mpl-2.0",
"hash": -7031751932246422000,
"line_mean": 33.88,
"line_max": 80,
"alpha_frac": 0.6076856897,
"autogenerated": false,
"ratio": 3.980593607305936,
"config_test":... |
from django.test import TestCase
import random
import string
import datetime
from conversation.models import Tweetdj
from bot.bin.thread import tweetdj_has_q_m
def randomString(stringLength=10):
"""Generate a random string of fixed length """
letters = string.ascii_letters
return ''.join(random.choice(lett... | {
"repo_name": "jeromecc/doctoctocbot",
"path": "src/bot/tests/bin/test_thread.py",
"copies": "1",
"size": "1229",
"license": "mpl-2.0",
"hash": -4070818843335105500,
"line_mean": 29.75,
"line_max": 72,
"alpha_frac": 0.6273393002,
"autogenerated": false,
"ratio": 3.5417867435158503,
"config_test... |
from django.test import TestCase
import re
class YoutubeTest(TestCase):
"""Test Youtube Pattern to get video id."""
def setUp(self):
"""docstring for setUp"""
self.video_id_pattern = re.compile(r"""^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??(v=)?([0-9a-zA-Z\-_]+).*$""")
... | {
"repo_name": "jtuz/django-events-calendar",
"path": "events/tests.py",
"copies": "1",
"size": "6263",
"license": "bsd-3-clause",
"hash": -6982539832695972000,
"line_mean": 80.3376623377,
"line_max": 162,
"alpha_frac": 0.627175475,
"autogenerated": false,
"ratio": 2.8339366515837106,
"config_te... |
from django.test import TestCase
import server.interface.nodes as views
from django.http import HttpResponse, HttpResponseNotFound, HttpResponseBadRequest
import server.interface.closest as cviews
import server.interface.util as util
from django.test.client import RequestFactory
class NodeTestCase(TestCase):
"""
... | {
"repo_name": "simonneuville/runamic_server",
"path": "djangoserver/server/interface/tests.py",
"copies": "1",
"size": "2059",
"license": "mit",
"hash": 8735036082625621000,
"line_mean": 38.5961538462,
"line_max": 115,
"alpha_frac": 0.64351627,
"autogenerated": false,
"ratio": 3.764168190127971,
... |
from django.test import TestCase
import simplejson as json
from rest_framework_swagger.renderers import SwaggerUIRenderer
from ..compat.mock import patch, MagicMock
class TestSwaggerUIRenderer(TestCase):
def setUp(self):
self.sut = SwaggerUIRenderer()
self.renderer_context = {'request': MagicMock... | {
"repo_name": "marcgibbons/django-rest-swagger",
"path": "tests/renderers/test_swagger.py",
"copies": "1",
"size": "5238",
"license": "bsd-2-clause",
"hash": 5447369690501306000,
"line_mean": 33.6887417219,
"line_max": 79,
"alpha_frac": 0.62294769,
"autogenerated": false,
"ratio": 3.8828762045959... |
from django.test import TestCase
import sqlite3
import mock
from opbeat.contrib.django.models import get_client, opbeat
class InstrumentSQLiteTest(TestCase):
def setUp(self):
self.client = get_client()
opbeat.instrumentation.control.instrument(self.client)
@mock.patch("opbeat.traces.RequestsS... | {
"repo_name": "dirtycoder/opbeat_python",
"path": "tests/instrumentation/sqlite_tests.py",
"copies": "2",
"size": "2364",
"license": "bsd-3-clause",
"hash": 475115892226661000,
"line_mean": 37.1290322581,
"line_max": 78,
"alpha_frac": 0.6290186125,
"autogenerated": false,
"ratio": 4.1256544502617... |
from django.test import TestCase
import swapper
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
import unittest
try:
from django.db import migrations # noqa
except ImportError:
DJ17 = False
else:
DJ17 = True
class SwapperTestCase(TestCase):
# Tests that sh... | {
"repo_name": "wq/django-swappable-models",
"path": "tests/test_swapper.py",
"copies": "1",
"size": "3710",
"license": "mit",
"hash": 373752326601257860,
"line_mean": 30.4406779661,
"line_max": 78,
"alpha_frac": 0.6013477089,
"autogenerated": false,
"ratio": 3.884816753926702,
"config_test": tr... |
from django.test import TestCase
import sys
class AdminBasicTest(TestCase):
fixtures = ['initial_data.json']
def test_admin_loads(self):
for (username, password) in (('superuser', '123'), ('staff', '123')):
logged_in = self.client.login(username=username, password=password)
se... | {
"repo_name": "husbas/django-admin-tools",
"path": "test_proj/test_app/tests.py",
"copies": "6",
"size": "1813",
"license": "mit",
"hash": 1758566164290808600,
"line_mean": 37.5744680851,
"line_max": 79,
"alpha_frac": 0.6276889134,
"autogenerated": false,
"ratio": 3.9846153846153847,
"config_te... |
from django.test import TestCase
# import the models to test
from vehicles.models import Category, Vehicle, VehicleMake
from vehicles.views import get_makes_in_category
class CategoryQuerySetTest(TestCase):
def setUp(self):
self.main_category = Category.objects.create(
category_name='Main Cat... | {
"repo_name": "sitture/trade-motors",
"path": "src/vehicles/tests/test_models.py",
"copies": "1",
"size": "10428",
"license": "mit",
"hash": 7177312791916312000,
"line_mean": 30.0357142857,
"line_max": 76,
"alpha_frac": 0.5838128117,
"autogenerated": false,
"ratio": 3.9129455909943713,
"config_... |
from django.test import TestCase
import time
from .models import SimpleTree, MPTTTree, TBMP, TBNS
def timeit(method):
""" Measure time of method's execution.
"""
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.time()
print '\n%r: %2.2f sec'... | {
"repo_name": "klen/simpletree",
"path": "benchmark/main/tests.py",
"copies": "1",
"size": "3596",
"license": "bsd-3-clause",
"hash": 4015299013694536000,
"line_mean": 22.0512820513,
"line_max": 94,
"alpha_frac": 0.5814794216,
"autogenerated": false,
"ratio": 3.5428571428571427,
"config_test": ... |
from django.test import TestCase
import unittest
from wagtail.tests.models import SimplePage, EventPage
from wagtail.tests.utils import login
from wagtail.wagtailcore.models import Page
from django.core.urlresolvers import reverse
class TestHome(TestCase):
def setUp(self):
# Login
login(self.clien... | {
"repo_name": "suziesparkle/wagtail",
"path": "wagtail/wagtailadmin/tests.py",
"copies": "3",
"size": "11572",
"license": "bsd-3-clause",
"hash": -6709410713774616000,
"line_mean": 36.3290322581,
"line_max": 133,
"alpha_frac": 0.6372277912,
"autogenerated": false,
"ratio": 3.771838331160365,
"c... |
from django.test import TestCase
import unittest
import git
from .gitstats import RepoStats, RemoteRepoStats
AUTHOR = 'David Gabor Bodor'
AUTHOR2 = 'Dávid Gábor BODOR'
class RepoStatsTestCase(TestCase):
def setUp(self, *args, **kwargs):
super().setUp(*args, **kwargs)
self.repo_stats = RepoStats('.... | {
"repo_name": "dragonfi/git-repo-stats",
"path": "statgetter/tests.py",
"copies": "1",
"size": "1305",
"license": "mit",
"hash": 1526264195919399400,
"line_mean": 37.3235294118,
"line_max": 71,
"alpha_frac": 0.7091327705,
"autogenerated": false,
"ratio": 3.7017045454545454,
"config_test": true,... |
from django.test import TestCase
import unittest
from .models import BagOfWords
class ModalityMock:
def __init__(self, index_id):
self.index_id = index_id
class TermMock:
def __init__(self, modality):
self.modality = modality
class TestBagOfWords(unittest.TestCase):
terms_index = dict... | {
"repo_name": "bigartm/visartm",
"path": "datasets/test.py",
"copies": "1",
"size": "1281",
"license": "bsd-3-clause",
"hash": -4314159683407741400,
"line_mean": 27.4666666667,
"line_max": 70,
"alpha_frac": 0.6088992974,
"autogenerated": false,
"ratio": 2.9516129032258065,
"config_test": true,
... |
from django.test import TestCase
import uuid
from dimagi.utils.parsing import json_format_datetime
from casexml.apps.case.mock import CaseBlock
from casexml.apps.case.models import CommCareCase
from casexml.apps.case.util import post_case_blocks
from casexml.apps.case.xml import V2
from corehq.apps.domain.shortcuts imp... | {
"repo_name": "puttarajubr/commcare-hq",
"path": "corehq/apps/users/tests/case_utils.py",
"copies": "3",
"size": "7524",
"license": "bsd-3-clause",
"hash": 6341737656318667000,
"line_mean": 40.1147540984,
"line_max": 106,
"alpha_frac": 0.6166932483,
"autogenerated": false,
"ratio": 3.587982832618... |
from django.test import TestCase
__author__ = 'adityabhasin'
import json
import os
from tech.repo import ingest_bulk
from h2h.settings import BASE_DIR
from tech.request_handler import get_filters_and_ranges, \
handle_query_request_internal, save_categories_internal, get_all_categories
from tech.tests import *
c... | {
"repo_name": "conlini/h2h",
"path": "tech/tests/test_request_handler.py",
"copies": "1",
"size": "4790",
"license": "mit",
"hash": 4907006726108191000,
"line_mean": 39.593220339,
"line_max": 103,
"alpha_frac": 0.5319415449,
"autogenerated": false,
"ratio": 3.9916666666666667,
"config_test": tr... |
from django.test import TestCase
class AdminBasicTest(TestCase):
def test_admin_loads(self):
self.assertTrue(self.client.login(username='staff', password='123'))
res = self.client.get('/admin/')
self.assertEqual(res.status_code, 200)
def test_permissions(self):
self.assertTrue(... | {
"repo_name": "grengojbo/grappelli-admin-tools-trunk",
"path": "test_proj/test_app/tests.py",
"copies": "2",
"size": "1277",
"license": "mit",
"hash": 3076397178032253000,
"line_mean": 38.90625,
"line_max": 80,
"alpha_frac": 0.6413469068,
"autogenerated": false,
"ratio": 3.8696969696969696,
"co... |
from django.test import TestCase
class AdminBasicTest(TestCase):
def index_page(self, username='staff', password='123'):
self.assertTrue(self.client.login(username=username, password=password))
return self.client.get('/admin/')
def test_admin_loads(self):
self.assertEqual(self.index_p... | {
"repo_name": "noxan/django-admin-tools",
"path": "test_proj/test_app/tests.py",
"copies": "6",
"size": "1338",
"license": "mit",
"hash": -6588467491930699000,
"line_mean": 37.2285714286,
"line_max": 80,
"alpha_frac": 0.6509715994,
"autogenerated": false,
"ratio": 3.912280701754386,
"config_tes... |
from django.test import TestCase
class MultiBlogIntegrityTest(TestCase):
fixtures = ['integrity']
def test_home_page_integrity(self):
response = self.client.get('/')
self.assertEquals(response.status_code, 200)
def test_blog_index_integrity(self):
response = self.client.get('... | {
"repo_name": "dduan/django-sophie",
"path": "sophie/tests/integrity_tests.py",
"copies": "1",
"size": "1336",
"license": "bsd-3-clause",
"hash": 8927067925431242000,
"line_mean": 35.1081081081,
"line_max": 66,
"alpha_frac": 0.6594311377,
"autogenerated": false,
"ratio": 3.752808988764045,
"con... |
from django.test import TestCase
class Testmaker(TestCase):
fixtures = ["eric"]
def setUp(self):
self.client.login(username='eric', password='test')
def test_local_built_test(self):
"A basic smoke test of creating a RTD Built projects"
r = self.client.get('/', {})
self.as... | {
"repo_name": "johncosta/private-readthedocs.org",
"path": "readthedocs/rtd_tests/tests/view_tests.py",
"copies": "2",
"size": "2838",
"license": "mit",
"hash": -1149938989962461000,
"line_mean": 51.5555555556,
"line_max": 278,
"alpha_frac": 0.6014799154,
"autogenerated": false,
"ratio": 3.374554... |
from django.test import TestCase
class UserTest(TestCase):
def test_profile_created(self):
"""
Tests that a new user gets a default profile
"""
from django.contrib.auth.models import User
u = User.objects.create(
username='test',
password='test'
... | {
"repo_name": "ProvidencePlan/Profiles",
"path": "communityprofiles/account/tests.py",
"copies": "2",
"size": "2523",
"license": "mit",
"hash": -2891932863439385000,
"line_mean": 34.5352112676,
"line_max": 83,
"alpha_frac": 0.5489496631,
"autogenerated": false,
"ratio": 4.219063545150502,
"conf... |
from django.test import TestCase
# Create your tests here.
#coding:utf-8
import time
import urllib2
import urllib
import json
def get_localtime():
return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
order_list={}
order_key=[]
def statics(eid,stat):
localtime = get_localtime()
if eid not in order... | {
"repo_name": "wxmgcs/devops",
"path": "monitor/tests.py",
"copies": "1",
"size": "1137",
"license": "mit",
"hash": 3417197319515042300,
"line_mean": 21.76,
"line_max": 89,
"alpha_frac": 0.6754617414,
"autogenerated": false,
"ratio": 3.1759776536312847,
"config_test": false,
"has_no_keywords"... |
from django.test import TestCase
# Create your tests here.
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.test import TestCase
from .models import Blog, Article
class BlogModelTest(TestCase):
def setUp(self):
self.user = get_user_model().objects.c... | {
"repo_name": "azul-cloud/tbscraper",
"path": "blog/tests.py",
"copies": "1",
"size": "1494",
"license": "mit",
"hash": -2453089509899819500,
"line_mean": 24.775862069,
"line_max": 63,
"alpha_frac": 0.6278447122,
"autogenerated": false,
"ratio": 3.840616966580977,
"config_test": true,
"has_no... |
from django.test import TestCase
# Create your tests here.
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.db.utils import IntegrityError
from django.db import transaction
from django.utils import timezone
from django.contrib.admin.sites import AlreadyRegis... | {
"repo_name": "craighagan/rvumanager",
"path": "rvusite/rvu/tests/tests.py",
"copies": "1",
"size": "2515",
"license": "apache-2.0",
"hash": 4431932643517233000,
"line_mean": 33.9305555556,
"line_max": 99,
"alpha_frac": 0.6998011928,
"autogenerated": false,
"ratio": 3.634393063583815,
"config_t... |
from django.test import TestCase
# Create your tests here.
from django.test import TestCase,Client
from contact_manager.models import Event, Contact
import unittest
#
class TestClient(unittest.TestCase):
def setUp(self):
self.client=Client()
self.event = Event(name = 'New Event',date = '2016-01-01'... | {
"repo_name": "ConnorH2582/sample-proj",
"path": "contact_manager/tests.py",
"copies": "1",
"size": "1256",
"license": "mit",
"hash": 8310439975154728000,
"line_mean": 33.8888888889,
"line_max": 139,
"alpha_frac": 0.6807324841,
"autogenerated": false,
"ratio": 3.738095238095238,
"config_test": ... |
from django.test import TestCase
# Create your tests here.
from django.test import TestCase, Client
from django.contrib.auth.models import User
from django.http import HttpRequest
from django.core.files import File
from posts.models import *
from author.models import *
from images.models import *
from django.test.uti... | {
"repo_name": "CMPUT410W15/cmput410-project",
"path": "images/tests.py",
"copies": "1",
"size": "4476",
"license": "apache-2.0",
"hash": -2631717817372288000,
"line_mean": 32.9166666667,
"line_max": 114,
"alpha_frac": 0.5983020554,
"autogenerated": false,
"ratio": 4,
"config_test": true,
"has... |
from django.test import TestCase
# Create your tests here.
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from apps.api.models import User
class UserTest(APITestCase):
def test_create_user(self):
url = reverse('signup')
data = {'user... | {
"repo_name": "dejwoo/xp_project",
"path": "apps/web/tests.py",
"copies": "2",
"size": "1033",
"license": "mit",
"hash": 1336000330709815300,
"line_mean": 35.8928571429,
"line_max": 112,
"alpha_frac": 0.6795740561,
"autogenerated": false,
"ratio": 3.797794117647059,
"config_test": true,
"has_... |
from django.test import TestCase
# Create your tests here.
from graph.models import Website, Article, Concept, ArticleConcept
import datetime
from django.conf import settings
from django.core import serializers
URL = "http://news-graph-pidupuis-2.c9.io"
class WebsiteMethodTests(TestCase):
def test_download_rss_a... | {
"repo_name": "Soaring-Outliers/news_graph",
"path": "graph/tests.py",
"copies": "1",
"size": "14618",
"license": "mit",
"hash": -5360372363279118000,
"line_mean": 62.5608695652,
"line_max": 909,
"alpha_frac": 0.5662197291,
"autogenerated": false,
"ratio": 3.397954439795444,
"config_test": true... |
from django.test import TestCase
# Create your tests here.
from tntapp.models import Materia, EventoMateria
from datetime import tzinfo, timedelta, datetime
ZERO = timedelta(0)
HOUR = timedelta(hours=1)
class FixedOffset(tzinfo):
"""Fixed offset in minutes east from UTC."""
def __init__(self, offset, name):
... | {
"repo_name": "Pazitos10/TNT",
"path": "webapp/app/tntapp/tests.py",
"copies": "1",
"size": "2790",
"license": "mit",
"hash": -6266064025659132000,
"line_mean": 36.2,
"line_max": 92,
"alpha_frac": 0.611827957,
"autogenerated": false,
"ratio": 3.2517482517482517,
"config_test": true,
"has_no_k... |
from django.test import TestCase
# Create your tests here.
import datetime
from django.utils import timezone
from polls.models import Poll
from django.core.urlresolvers import reverse
def create_poll(question, days):
"""
Creates a poll with the given `question` published the given number of
`days` offset... | {
"repo_name": "davidaparicio/django_officialtutorial",
"path": "polls/tests.py",
"copies": "2",
"size": "4620",
"license": "mit",
"hash": -3809933039483805700,
"line_mean": 37.8235294118,
"line_max": 83,
"alpha_frac": 0.6335497835,
"autogenerated": false,
"ratio": 3.9352640545144806,
"config_te... |
from django.test import TestCase
# Create your tests here.
import datetime
from django.utils import timezone
from django.test import TestCase
from django.urls import reverse
from .models import Question
class QuestionMethodTests(TestCase):
def test_was_published_recently_with_future_question(self):
""... | {
"repo_name": "gavmain/django_demo",
"path": "demo/polls/tests.py",
"copies": "1",
"size": "4631",
"license": "mit",
"hash": 802870367313013600,
"line_mean": 37.5916666667,
"line_max": 83,
"alpha_frac": 0.6499676096,
"autogenerated": false,
"ratio": 4.175834084761046,
"config_test": true,
"ha... |
from django.test import TestCase
# Create your tests here.
from catalog.models import Author
from django.core.urlresolvers import reverse
class AuthorsListViewTest(TestCase):
@classmethod
def setUpTestData(cls):
# Create 13 authors for pagination test
number_of_authors = 13
for author_num in range(number_of... | {
"repo_name": "byronvhughey/django_local_library",
"path": "catalog/tests/test_views.py",
"copies": "1",
"size": "9559",
"license": "mit",
"hash": -6681761472028865000,
"line_mean": 38.3374485597,
"line_max": 156,
"alpha_frac": 0.7167067685,
"autogenerated": false,
"ratio": 3.306468350051885,
"... |
from django.test import TestCase
# Create your tests here.
from catalog.models import Author
class AuthorModelTest(TestCase):
@classmethod
def setUpTestData(cls):
# Set up non-modified objects used by all test methods
Author.objects.create(first_name='Big', last_name='Bob')
def test_first_name_label(self):
... | {
"repo_name": "Konosh93/locallibrary",
"path": "catalog/tests/test_models.py",
"copies": "1",
"size": "1814",
"license": "mit",
"hash": 1918872095607254300,
"line_mean": 26.9230769231,
"line_max": 85,
"alpha_frac": 0.7293274531,
"autogenerated": false,
"ratio": 3.0334448160535117,
"config_test"... |
from django.test import TestCase
# Create your tests here.
from django.utils import timezone
from stock.models import Supplier, Coming, StockRecord, ComingProducts
from stock.utils import create_sr_main
from stock.constants import LIFO, FIFO
from orders.models import Order, OrderProducts
from orders.constants import ... | {
"repo_name": "juntatalor/qexx",
"path": "stock/tests.py",
"copies": "1",
"size": "3917",
"license": "mit",
"hash": -219449582199417300,
"line_mean": 46.3378378378,
"line_max": 105,
"alpha_frac": 0.688463735,
"autogenerated": false,
"ratio": 2.940386230058774,
"config_test": true,
"has_no_key... |
from django.test import TestCase
# Create your tests here.
import datetime
from django.utils import timezone
from catalog.forms import RenewBookForm
class RenewBookFormTest(TestCase):
def test_renew_form_date_in_past(self):
"""
Test form is invalid if renewal_date is before today
"""
... | {
"repo_name": "schaabm/test-pipeline",
"path": "catalog/tests/test_forms.py",
"copies": "2",
"size": "2093",
"license": "cc0-1.0",
"hash": 8964805182953181000,
"line_mean": 33.3278688525,
"line_max": 121,
"alpha_frac": 0.6053511706,
"autogenerated": false,
"ratio": 3.744186046511628,
"config_te... |
from django.test import TestCase
# Create your tests here.
print('test_forms running')
import datetime
from django.utils import timezone
from catalog.forms import RenewBookForm
class RenewBookFormTest(TestCase):
def test_renew_form_date_field_label(self):
form = RenewBookForm()
self.asser... | {
"repo_name": "mrmarkhurlburt/django_media_library",
"path": "catalog/tests/test_forms.py",
"copies": "1",
"size": "1659",
"license": "cc0-1.0",
"hash": 1735523698107796200,
"line_mean": 36.7045454545,
"line_max": 121,
"alpha_frac": 0.6497890295,
"autogenerated": false,
"ratio": 3.514830508474576... |
from django.test import TestCase
# for Selenium testing
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from growthstreet.models import LoanRequest
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from selenium import webdriver
from selenium.webdr... | {
"repo_name": "NamanJn/django-tech-test",
"path": "growthstreet/tests.py",
"copies": "1",
"size": "3088",
"license": "bsd-3-clause",
"hash": 8675126659616221000,
"line_mean": 29.88,
"line_max": 99,
"alpha_frac": 0.6466968912,
"autogenerated": false,
"ratio": 3.8648310387984983,
"config_test": t... |
from django.test import TestCase
from accelerator.models import (
NavTree,
NavTreeItem
)
from accelerator.tests.factories import (
UserRoleFactory,
ProgramFactory,
ProgramFamilyFactory
)
from accelerator.sitetree_navigation.utils import (
create_items,
add_user_roles_to_nav_items,
add_a... | {
"repo_name": "masschallenge/django-accelerator",
"path": "accelerator/sitetree_navigation/tests/test_utils.py",
"copies": "1",
"size": "7403",
"license": "mit",
"hash": -8704413672693864000,
"line_mean": 35.8308457711,
"line_max": 78,
"alpha_frac": 0.6102931244,
"autogenerated": false,
"ratio": ... |
from django.test import TestCase
from accounts.models import Account, Profile
from activities.models import Activity, Notification
class ActivityModelTests(TestCase):
def setUp(self):
self.account = Account.objects.create(
first_name='Anton', last_name='Antonov', gender=Account.MALE)
... | {
"repo_name": "syndbg/dj-socbook",
"path": "socbook/activities/tests/test_models.py",
"copies": "1",
"size": "3515",
"license": "mit",
"hash": -2637177453258235000,
"line_mean": 33.1262135922,
"line_max": 90,
"alpha_frac": 0.6864864865,
"autogenerated": false,
"ratio": 3.9852607709750565,
"conf... |
from django.test import TestCase
from addressbase.models import UprnToCouncil, Address
from councils.tests.factories import CouncilFactory
from data_importers.tests.stubs import stub_dcountsimport
from pollingstations.models import PollingStation
class DemocracyCountsImportTests(TestCase):
opts = {"nochecks": T... | {
"repo_name": "DemocracyClub/UK-Polling-Stations",
"path": "polling_stations/apps/data_importers/tests/test_dcounts.py",
"copies": "1",
"size": "3143",
"license": "bsd-3-clause",
"hash": -8577614394844846000,
"line_mean": 28.9333333333,
"line_max": 84,
"alpha_frac": 0.5065224308,
"autogenerated": f... |
from django.test import TestCase
from ..admin import MyUserCreationForm
from ..models import User
class TestMyUserCreationForm(TestCase):
def setUp(self):
self.user = User.objects.create_user(username='notalamode',
email=None,
... | {
"repo_name": "evanepio/dotmanca",
"path": "dotmanca/users/tests/test_admin.py",
"copies": "1",
"size": "1544",
"license": "mit",
"hash": 5395312609474013000,
"line_mean": 34.9069767442,
"line_max": 78,
"alpha_frac": 0.5997409326,
"autogenerated": false,
"ratio": 4.150537634408602,
"config_test... |
from django.test import TestCase
from ..admin import MyUserCreationForm
class TestMyUserCreationForm(TestCase):
def setUp(self):
self.user = self.make_user('notalamode', 'notalamodespassword')
def test_clean_username_success(self):
# Instantiate the form with a new username
form = M... | {
"repo_name": "ilendl2/wagtail-cookiecutter-foundation",
"path": "{{cookiecutter.project_slug}}/users/tests/test_admin.py",
"copies": "2",
"size": "1388",
"license": "mit",
"hash": -8373124133868723000,
"line_mean": 33.7,
"line_max": 78,
"alpha_frac": 0.6282420749,
"autogenerated": false,
"ratio"... |
from django.test import TestCase
from adyen.gateway import Constants
from adyen.scaffold import Scaffold
from tests import MockRequest
AUTHORISED_PAYMENT_PARAMS_POST = {
'currency': 'EUR',
'eventCode': 'AUTHORISATION',
'live': 'false',
'eventDate': '2014-10-18T17:00:00.00Z',
'merchantAccountCode':... | {
"repo_name": "oscaro/django-oscar-adyen",
"path": "tests/test_notifications.py",
"copies": "2",
"size": "3221",
"license": "bsd-3-clause",
"hash": -8209409513485967000,
"line_mean": 37.8072289157,
"line_max": 91,
"alpha_frac": 0.6566283763,
"autogenerated": false,
"ratio": 3.8807228915662653,
... |
from django.test import TestCase
from api.analysis import calc_fixing_time
from api.tests.db_utils import clear_db, insert_feedbacks_for_estimation
class EstimationTimeTestCase(TestCase):
@classmethod
def setUpClass(cls):
clear_db()
insert_feedbacks_for_estimation()
@classmethod
def ... | {
"repo_name": "hep7agon/city-feedback-hub",
"path": "api/tests/test_analysis.py",
"copies": "1",
"size": "1100",
"license": "mit",
"hash": 284768832945020800,
"line_mean": 30.4285714286,
"line_max": 72,
"alpha_frac": 0.6854545455,
"autogenerated": false,
"ratio": 3.5256410256410255,
"config_tes... |
from django.test import TestCase
from api_v3.factories import SubscriberFactory, ProfileFactory
from api_v3.misc import oauth2
from api_v3.models import Subscriber, Action
class TicketAttachmentCommentFactoryMixin(TestCase):
def setUp(self):
self.new_user = ProfileFactory.create()
self.subscribe... | {
"repo_name": "occrp/id-backend",
"path": "api_v3/tests/misc/test_oauth2.py",
"copies": "1",
"size": "1265",
"license": "mit",
"hash": 5398291381743891000,
"line_mean": 30.625,
"line_max": 75,
"alpha_frac": 0.6893280632,
"autogenerated": false,
"ratio": 3.8333333333333335,
"config_test": false,... |
from django.test import TestCase
from app.models import GameState
class TestGameActions(TestCase):
def test_use_lost(self):
'''Verify that the game fails when the player exceeds the
max number of failed guesses.
'''
game = GameState.objects.create(word="sowpod", guessed="xyvqulkt... | {
"repo_name": "twneale/hangman",
"path": "app/tests.py",
"copies": "1",
"size": "2205",
"license": "bsd-3-clause",
"hash": 5087815599943540000,
"line_mean": 34,
"line_max": 76,
"alpha_frac": 0.633106576,
"autogenerated": false,
"ratio": 3.994565217391304,
"config_test": true,
"has_no_keywords... |
from django.test import TestCase
from apps.checkout import forms
from oscar.apps.address import models
from oscar.apps.order import models as order_models
class TestBillingAddressForm(TestCase):
def setUp(self):
models.Country.objects.create(
iso_3166_1_a2='GB', name="Great Britain")
... | {
"repo_name": "marcoantoniooliveira/labweb",
"path": "sites/demo/tests/test_checkout_forms.py",
"copies": "34",
"size": "2092",
"license": "bsd-3-clause",
"hash": -8853109300653184000,
"line_mean": 30.696969697,
"line_max": 84,
"alpha_frac": 0.5057361377,
"autogenerated": false,
"ratio": 3.824497... |
from django.test import TestCase
from apps.dvcards.display_pager import DisplayPager
from dataverse_org.utils.msg_util import *
class DisplayPagerTests(TestCase):
def test_calculation_for_current_page(self):
"""
Tests that 1 + 1 always equals 2.
"""
msgt('Test calculation for curr... | {
"repo_name": "IQSS/dataverse.org",
"path": "dataverse_org/apps/dvcards/tests.py",
"copies": "2",
"size": "3812",
"license": "mit",
"hash": -6258544747130757000,
"line_mean": 37.8979591837,
"line_max": 96,
"alpha_frac": 0.6017838405,
"autogenerated": false,
"ratio": 3.166112956810631,
"config_t... |
from django.test import TestCase
from apps.explorer.forms import str_to_set
class StrToSetTestCase(TestCase):
def test_empty_input_returns_empty_set(self):
result = str_to_set('')
assert type(result) == set
assert len(result) == 0
def test_returns_set(self):
result = str_t... | {
"repo_name": "Candihub/pixel",
"path": "apps/explorer/tests/test_forms.py",
"copies": "1",
"size": "1647",
"license": "bsd-3-clause",
"hash": 1456891774596045000,
"line_mean": 22.5285714286,
"line_max": 49,
"alpha_frac": 0.5379477838,
"autogenerated": false,
"ratio": 3.6518847006651884,
"confi... |
from django.test import TestCase
from apps.wiki.models import WikiItem
from should_dsl import should, should_not
class WikiModelsTests(TestCase):
def test_it_has_title_and_content_and_slug(self):
self.wiki_item = WikiItem(
title='Add Plone Site',
content='Click on "Add Plone Sit... | {
"repo_name": "nsi-iff/nsi_site",
"path": "apps/wiki/tests/test_models.py",
"copies": "1",
"size": "1727",
"license": "mit",
"hash": -94153519439280510,
"line_mean": 41.1219512195,
"line_max": 88,
"alpha_frac": 0.6328894036,
"autogenerated": false,
"ratio": 3.2523540489642184,
"config_test": tr... |
from django.test import TestCase
from archives.models import Archive
from archives.policies import CdimageArchivePolicy
from archives.archivers import SshArchiver
from credentials.tests.factories import SshKeyPairFactory
from .factories import ArchiveFactory
class ArchiveTest(TestCase):
def setUp(self):
... | {
"repo_name": "timrchavez/capomastro",
"path": "archives/tests/test_models.py",
"copies": "1",
"size": "1332",
"license": "mit",
"hash": 8033630058571015000,
"line_mean": 32.3,
"line_max": 79,
"alpha_frac": 0.6614114114,
"autogenerated": false,
"ratio": 4.352941176470588,
"config_test": true,
... |
from django.test import TestCase
from avocado.columns.models import Column
from avocado.modeltree import DEFAULT_MODELTREE_ALIAS
from avocado.fields.utils import M, AmbiguousField
__all__ = ('MTestCase',)
class MTestCase(TestCase):
fixtures = ['test_data.yaml']
def test_variations(self):
concepts = ... | {
"repo_name": "pombredanne/django-avocado",
"path": "avocado/fields/tests/utils.py",
"copies": "1",
"size": "1539",
"license": "bsd-3-clause",
"hash": -9032570632113887000,
"line_mean": 34.7906976744,
"line_max": 88,
"alpha_frac": 0.6660168941,
"autogenerated": false,
"ratio": 3.655581947743468,
... |
from django.test import TestCase
from backend.images.factories import ImageSeriesFactory
from backend.images.models import ImageSeries
class SmokeTest(TestCase):
def test_create_image_series(self):
image_series = ImageSeriesFactory()
self.assertRegex(image_series.series_instance_uid, '^[0-9\.]{64... | {
"repo_name": "antonow/concept-to-clinic",
"path": "interface/backend/images/tests.py",
"copies": "1",
"size": "1258",
"license": "mit",
"hash": 6346759268269343000,
"line_mean": 47.3846153846,
"line_max": 117,
"alpha_frac": 0.686009539,
"autogenerated": false,
"ratio": 2.9739952718676124,
"con... |
from django.test import TestCase
from backend.models import Concert
from backend.tests.helpers import login, create_user, create_festival, create_concert
from backend.tests.helpers import create_client
class DeleteConcertTests(TestCase):
def test_no_client_name_provided(self):
"""
delete_concert(... | {
"repo_name": "amentis/FestPal-Server",
"path": "backend/tests/test_delete_concert.py",
"copies": "1",
"size": "3583",
"license": "apache-2.0",
"hash": 5114163645971376000,
"line_mean": 35.1919191919,
"line_max": 102,
"alpha_frac": 0.61568518,
"autogenerated": false,
"ratio": 3.8903365906623235,
... |
from django.test import TestCase
from backend.models import InvalidPermissionStringError, Client
from backend.models import client_has_permission
from backend.tests.helpers import create_client
class ClientHasPermissionTests(TestCase):
def test_wrong_permission(self):
"""
client_has_permission() ... | {
"repo_name": "amentis/FestPal-Server",
"path": "backend/tests/test_client_has_permission.py",
"copies": "1",
"size": "1592",
"license": "apache-2.0",
"hash": 2714693178770458600,
"line_mean": 39.8205128205,
"line_max": 83,
"alpha_frac": 0.6639447236,
"autogenerated": false,
"ratio": 4.2795698924... |
from django.test import TestCase
from backend.tests.helpers import login, create_festival, create_user
from backend.tests.helpers import create_client
class VoteTests(TestCase):
def test_no_client_name_provided(self):
"""
vote() is to return "Client name not provided"
if no client name is... | {
"repo_name": "amentis/FestPal-Server",
"path": "backend/tests/test_vote.py",
"copies": "1",
"size": "2268",
"license": "apache-2.0",
"hash": -6697705545491679000,
"line_mean": 33.8923076923,
"line_max": 89,
"alpha_frac": 0.6164021164,
"autogenerated": false,
"ratio": 3.8969072164948453,
"confi... |
from django.test import TestCase
from base import SharedMemoryModel
from django.db import models
class Category(SharedMemoryModel):
name = models.CharField(max_length=32)
class RegularCategory(models.Model):
name = models.CharField(max_length=32)
class Article(SharedMemoryModel):
name = models.CharField... | {
"repo_name": "TaliesinSkye/evennia",
"path": "src/utils/idmapper/tests.py",
"copies": "7",
"size": "2741",
"license": "bsd-3-clause",
"hash": 7578072340296554000,
"line_mean": 38.1714285714,
"line_max": 109,
"alpha_frac": 0.6661802262,
"autogenerated": false,
"ratio": 4.20398773006135,
"config... |
from django.test import TestCase
from bestiary.models import GameItem
from data_log import models
class LogEntryTests(TestCase):
# Testing LogEntry model using a concrete subclass
def test_parse_common_log_data(self):
log = models.SummonLog()
log.parse_common_log_data({
'request':... | {
"repo_name": "PeteAndersen/swarfarm",
"path": "data_log/tests/test_log_models.py",
"copies": "1",
"size": "10195",
"license": "apache-2.0",
"hash": -5233159011907343000,
"line_mean": 33.795221843,
"line_max": 122,
"alpha_frac": 0.5487003433,
"autogenerated": false,
"ratio": 3.5215889464594126,
... |
from django.test import TestCase
from blog.models import (
ArticleComment,
Commenter,
)
from .util import (
make_time,
create_author,
create_article,
create_comment,
)
class ArticleAdminControlsTestCase(TestCase):
def test_delete_comment(self):
author = create_author()
ar... | {
"repo_name": "w0rp/w0rpzone",
"path": "blog/tests/test_article_admin_controls.py",
"copies": "1",
"size": "3846",
"license": "bsd-2-clause",
"hash": 9128369829068032000,
"line_mean": 26.4714285714,
"line_max": 70,
"alpha_frac": 0.6424856994,
"autogenerated": false,
"ratio": 3.8192651439920557,
... |
from django.test import TestCase
from bluebottle.bluebottle_utils.tests import generate_random_slug
from .models import Organization
class OrganizationTestsMixin(object):
""" Mixin base class for tests using organizations. """
def create_organization(self, slug=None):
"""
Create a 'default'... | {
"repo_name": "gannetson/sportschooldeopenlucht",
"path": "apps/organizations/tests.py",
"copies": "1",
"size": "1088",
"license": "bsd-3-clause",
"hash": 4318918687419089000,
"line_mean": 28.4054054054,
"line_max": 78,
"alpha_frac": 0.6654411765,
"autogenerated": false,
"ratio": 4.96803652968036... |
from django.test import TestCase
from boardinghouse.models import Schema
class TestSchemaQuerysetMethods(TestCase):
def test_active(self):
Schema.objects.mass_create('a', 'b', 'c')
self.assertEquals(
set(['a', 'b', 'c']),
set(Schema.objects.active().values_list('schema', f... | {
"repo_name": "luzfcb/django-boardinghouse",
"path": "tests/tests/test_schema_model.py",
"copies": "1",
"size": "1142",
"license": "bsd-3-clause",
"hash": 2328981143304450000,
"line_mean": 29.8648648649,
"line_max": 75,
"alpha_frac": 0.5551663748,
"autogenerated": false,
"ratio": 3.97909407665505... |
from django.test import TestCase
from boardinghouse.schema import get_schema_model
from ..models import AwareModel, NaiveModel
Schema = get_schema_model()
class TestPartitioning(TestCase):
def test_aware_objects_are_created_in_active_schema(self):
first = Schema.objects.create(name='first', schema='firs... | {
"repo_name": "luzfcb/django-boardinghouse",
"path": "tests/tests/test_objects_are_partitioned.py",
"copies": "1",
"size": "2423",
"license": "bsd-3-clause",
"hash": 3489702914866514000,
"line_mean": 36.859375,
"line_max": 95,
"alpha_frac": 0.6784977301,
"autogenerated": false,
"ratio": 3.8830128... |
from django.test import TestCase
from boardinghouse.schema import get_schema_model
from ..models import AwareModel
Schema = get_schema_model()
class TestMultiSchemaManager(TestCase):
def test_multi_schema_fetches_objects_correctly(self):
Schema.objects.mass_create('a', 'b')
a = Schema.objects.g... | {
"repo_name": "luzfcb/django-boardinghouse",
"path": "tests/tests/test_multi_schema_manager.py",
"copies": "1",
"size": "1631",
"license": "bsd-3-clause",
"hash": 3713711819908419600,
"line_mean": 32.9791666667,
"line_max": 130,
"alpha_frac": 0.652360515,
"autogenerated": false,
"ratio": 3.576754... |
from django.test import TestCase
from books.models import Author, GoodreadsAuthor
class TestCreateFromGoodreads(TestCase):
def setUp(self):
Author.objects.create(
name='John Smith',
link='http://johnsmith.com',
slug='john-smith',
)
def test_new_author(self... | {
"repo_name": "dellsystem/bookmarker",
"path": "src/bookmarker/tests/test_authors.py",
"copies": "1",
"size": "3628",
"license": "mit",
"hash": -3462759701349771300,
"line_mean": 36.7916666667,
"line_max": 66,
"alpha_frac": 0.618246968,
"autogenerated": false,
"ratio": 3.7556935817805384,
"conf... |
from django.test import TestCase
from books.models import Book, BookDetails
class TestCreateFromGoodreads(TestCase):
def setUp(self):
self.book = Book.objects.create_from_goodreads({
'id': '123',
'title': 'Book: Something',
'link': 'link',
'format': 'Hardco... | {
"repo_name": "dellsystem/bookmarker",
"path": "src/bookmarker/tests/test_books.py",
"copies": "1",
"size": "5314",
"license": "mit",
"hash": -5262877139628775000,
"line_mean": 40.515625,
"line_max": 151,
"alpha_frac": 0.5790365073,
"autogenerated": false,
"ratio": 3.4914586070959266,
"config_t... |
from django.test import TestCase
from builds.models import Version
from projects.models import Project
import logging
class RedirectTests(TestCase):
fixtures = ["eric", "test_data"]
def setUp(self):
logging.disable(logging.DEBUG)
self.client.login(username='eric', password='test')
s... | {
"repo_name": "nyergler/pythonslides",
"path": "readthedocs/rtd_tests/tests/test_redirects.py",
"copies": "4",
"size": "7120",
"license": "mit",
"hash": 6516893038025797000,
"line_mean": 40.3953488372,
"line_max": 84,
"alpha_frac": 0.6176966292,
"autogenerated": false,
"ratio": 3.5582208895552223... |
from django.test import TestCase
from builds.models import Version
from projects.models import Project
class RedirectSingleVersionTests(TestCase):
fixtures = ["eric", "test_data"]
def setUp(self):
self.pip = Project.objects.get(slug='pip')
self.pip.single_version = True
self.pip.save... | {
"repo_name": "nikolas/readthedocs.org",
"path": "readthedocs/rtd_tests/tests/test_single_version.py",
"copies": "2",
"size": "1937",
"license": "mit",
"hash": -1952665092346190000,
"line_mean": 37.74,
"line_max": 94,
"alpha_frac": 0.6690758906,
"autogenerated": false,
"ratio": 3.57380073800738,
... |
from django.test import TestCase
from cacheback.function import FunctionJob
from cacheback.decorators import cacheback
def fetch():
return 1, 2, 3
def fetch_with_args(*args):
return args
class TestDecorator(TestCase):
def test_wrapping_argless_function(self):
decorated_fetch = cacheback(fetc... | {
"repo_name": "jayfk/django-cacheback",
"path": "tests/decorator_tests.py",
"copies": "5",
"size": "2064",
"license": "mit",
"hash": -426585180087812030,
"line_mean": 28.4857142857,
"line_max": 76,
"alpha_frac": 0.6501937984,
"autogenerated": false,
"ratio": 4.039138943248532,
"config_test": tr... |
from django.test import TestCase
from cartoview import get_current_version
from cartoview.version import get_version, json_version_info
class CartoviewVersionModule(TestCase):
def test_json_version_info(self):
version_text = json_version_info()
self.assertTrue(isinstance(version_text, str))
... | {
"repo_name": "cartologic/cartoview",
"path": "cartoview/tests/test_version_module.py",
"copies": "1",
"size": "1049",
"license": "bsd-2-clause",
"hash": -4482755050853928400,
"line_mean": 35.1724137931,
"line_max": 60,
"alpha_frac": 0.6215443279,
"autogenerated": false,
"ratio": 3.46204620462046... |
from django.test import TestCase
from celery.exceptions import Retry
from mock import patch, Mock
from basket.news.backends.common import NewsletterException
from basket.news.tasks import confirm_user
@patch('basket.news.tasks.sfdc')
@patch('basket.news.tasks.get_user_data')
class TestConfirmTask(TestCase):
def... | {
"repo_name": "glogiotatidis/basket",
"path": "basket/news/tests/test_confirm.py",
"copies": "1",
"size": "1615",
"license": "mpl-2.0",
"hash": -8152395366843721000,
"line_mean": 35.7045454545,
"line_max": 91,
"alpha_frac": 0.6191950464,
"autogenerated": false,
"ratio": 3.7211981566820276,
"con... |
from django.test import TestCase
from censusdata.models import Census2010RaceStats
from geo.models import Geo
class Census2010RaceStatsTest(TestCase):
fixtures = ['dummy_tracts']
def test_auto_populated(self):
tract = Geo.objects.get(pk='1122233300')
stats = Census2010RaceStats(
... | {
"repo_name": "mehtadev17/mapusaurus",
"path": "mapusaurus/censusdata/tests/test_models.py",
"copies": "2",
"size": "1614",
"license": "cc0-1.0",
"hash": 9015558484936926000,
"line_mean": 41.4736842105,
"line_max": 73,
"alpha_frac": 0.6573729864,
"autogenerated": false,
"ratio": 2.856637168141592... |
from django.test import TestCase
from chamber.utils.datastructures import ChoicesEnum, ChoicesNumEnum, Enum, NumEnum, OrderedSet
from germanium.tools import assert_equal, assert_raises, assert_is_none, assert_in, assert_not_in
class DatastructuresTestCase(TestCase):
def test_enum_should_contain_only_defined_va... | {
"repo_name": "druids/django-chamber",
"path": "example/dj/apps/test_chamber/tests/utils/datastructures.py",
"copies": "1",
"size": "6897",
"license": "bsd-3-clause",
"hash": -7039398099266681000,
"line_mean": 35.4920634921,
"line_max": 99,
"alpha_frac": 0.538784979,
"autogenerated": false,
"rati... |
from django.test import TestCase
from chat.models import Message
class UndeliveredTestCase(TestCase):
fixtures = ['undelivered']
def test_undelivered(self):
"""Undelivered method should return undelivered messages"""
messages = Message.objects.undelivered()
self.assertEqual(len(messa... | {
"repo_name": "tomi77/django-chat",
"path": "tests/tests.py",
"copies": "1",
"size": "1266",
"license": "mit",
"hash": -3541674813279986000,
"line_mean": 37.3636363636,
"line_max": 75,
"alpha_frac": 0.6176935229,
"autogenerated": false,
"ratio": 4.537634408602151,
"config_test": false,
"has_n... |
from django.test import TestCase
from cms.models import CMSPlugin
from project.models import (
SimpleInheritancePlugin,
AbstractInheritancePlugin,
MultilevelInheritancePlugin,
DesiredMethodCalled,
)
class InheritanceTest(TestCase):
def tearDown(self):
SimpleInheritancePlugin.objects.all... | {
"repo_name": "philippze/djangocms-multi-inheritance",
"path": "the_right_way/project/tests.py",
"copies": "1",
"size": "1545",
"license": "mit",
"hash": 7851621394929280000,
"line_mean": 26.5892857143,
"line_max": 58,
"alpha_frac": 0.616828479,
"autogenerated": false,
"ratio": 4.3277310924369745... |
from django.test import TestCase
from common.models import Project
from common.tasks import launch_process
from testreport.models import TestPlan
from testreport.models import Launch
from testreport.models import TestResult
from testreport.models import FAILED
from testreport.models import PASSED
class ProjectTests... | {
"repo_name": "2gis/badger-api",
"path": "testreport/tests.py",
"copies": "1",
"size": "3951",
"license": "mit",
"hash": 5128444425047852000,
"line_mean": 30.3571428571,
"line_max": 79,
"alpha_frac": 0.5990888383,
"autogenerated": false,
"ratio": 3.908011869436202,
"config_test": true,
"has_n... |
from django.test import TestCase
from competition.models.competition_model import Competition
from competition.tests.factories import (CompetitionFactory, UserFactory,
OrganizerFactory)
class OrganizerModelTest(TestCase):
def setUp(self):
self.alice = UserFactory... | {
"repo_name": "michaelwisely/django-competition",
"path": "src/competition/tests/organizer_tests/organizer_model_tests.py",
"copies": "1",
"size": "1569",
"license": "bsd-3-clause",
"hash": 7105957309030684000,
"line_mean": 43.8285714286,
"line_max": 80,
"alpha_frac": 0.6443594646,
"autogenerated":... |
from django.test import TestCase
from conman.compat import DJANGO_LT_19
from conman.routes.tests.factories import ChildRouteFactory
from conman.tests.utils import RequestTestCase
from .factories import ChildRouteRedirectFactory, URLRedirectFactory
from .. import views
class TestRouteRedirectView(RequestTestCase):
... | {
"repo_name": "Ian-Foote/django-conman",
"path": "conman/redirects/tests/test_views.py",
"copies": "1",
"size": "2908",
"license": "bsd-2-clause",
"hash": 5940122649673640000,
"line_mean": 34.9012345679,
"line_max": 76,
"alpha_frac": 0.6791609354,
"autogenerated": false,
"ratio": 4.31454005934718... |
from django.test import TestCase
from conman.redirects import views
from tests.routes.factories import ChildRouteFactory
from tests.utils import RequestTestCase
from .factories import ChildRouteRedirectFactory, URLRedirectFactory
class RouteRedirectViewTest(RequestTestCase):
"""Verify behaviour of RouteRedirect... | {
"repo_name": "meshy/django-conman",
"path": "tests/redirects/test_views.py",
"copies": "1",
"size": "2763",
"license": "bsd-2-clause",
"hash": -146040218124897630,
"line_mean": 34.4230769231,
"line_max": 76,
"alpha_frac": 0.6833152371,
"autogenerated": false,
"ratio": 4.358044164037855,
"confi... |
from django.test import TestCase
from core.forms import TransformationForm
from core.models import get_transformation_type_choices
class TransformationFormTestCase(TestCase):
def test_python_prohibited(self):
test_body = {
'name': 'Test Transformation',
'payload': 'test payload',
... | {
"repo_name": "WSULib/combine",
"path": "tests/test_forms/test_transformation_form.py",
"copies": "1",
"size": "1425",
"license": "mit",
"hash": 6004229006830385000,
"line_mean": 33.756097561,
"line_max": 55,
"alpha_frac": 0.5803508772,
"autogenerated": false,
"ratio": 4.331306990881459,
"confi... |
from django.test import TestCase
from corehq.apps.users.dbaccessors.all_commcare_users import delete_all_users
from corehq.apps.users.models import CouchUser, WebUser, CommCareUser
from corehq.apps.domain.models import Domain
from corehq.apps.domain.shortcuts import create_domain
class CreateTestCase(TestCase):
... | {
"repo_name": "qedsoftware/commcare-hq",
"path": "corehq/apps/users/tests/create.py",
"copies": "1",
"size": "5388",
"license": "bsd-3-clause",
"hash": -955055382870873100,
"line_mean": 39.2089552239,
"line_max": 94,
"alpha_frac": 0.6742761693,
"autogenerated": false,
"ratio": 3.625841184387618,
... |
from django.test import TestCase
from corehq.form_processor.tests.utils import run_with_all_backends
from corehq.form_processor.interfaces.supply import SupplyInterface
from casexml.apps.case.tests.util import delete_all_cases
from corehq.apps.commtrack.dbaccessors import get_supply_point_ids_in_domain_by_location
fro... | {
"repo_name": "qedsoftware/commcare-hq",
"path": "corehq/apps/commtrack/tests/test_dbaccessors.py",
"copies": "1",
"size": "1836",
"license": "bsd-3-clause",
"hash": 4188604756968498000,
"line_mean": 38.0638297872,
"line_max": 88,
"alpha_frac": 0.6710239651,
"autogenerated": false,
"ratio": 3.672... |
from django.test import TestCase
from core.tests.mommy_utils import make_recipe
from cla_eventlog import event_registry
from cla_eventlog.models import Log
from cla_eventlog.tests.base import EventTestCaseMixin
from cla_eventlog.constants import LOG_TYPES, LOG_LEVELS
class CaseEventTestCase(EventTestCaseMixin, Test... | {
"repo_name": "ministryofjustice/cla_backend",
"path": "cla_backend/apps/legalaid/tests/test_events.py",
"copies": "1",
"size": "5998",
"license": "mit",
"hash": -8218674382600234000,
"line_mean": 34.9161676647,
"line_max": 102,
"alpha_frac": 0.6347115705,
"autogenerated": false,
"ratio": 3.33964... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.