text
stringlengths
0
1.05M
meta
dict
from django.test import TestCase from rest_framework.exceptions import ValidationError from rest_framework.fields import SkipField from django_enumfield.contrib.drf import EnumField, NamedEnumField from django_enumfield.tests.models import BeerState, LampState class DRFTestCase(TestCase): def test_enum_field(sel...
{ "repo_name": "5monkeys/django-enumfield", "path": "django_enumfield/tests/test_contrib.py", "copies": "1", "size": "1237", "license": "mit", "hash": -604870300366904400, "line_mean": 37.65625, "line_max": 75, "alpha_frac": 0.7016976556, "autogenerated": false, "ratio": 3.7713414634146343, "con...
from django.test import TestCase from rest_framework.exceptions import ValidationError from base.models import MapObject class MapObjectModelTests(TestCase): def test_representation(self): obj = MapObject(name='Test') self.assertEqual(repr(obj), '<MapObject Test>') def test_string_representa...
{ "repo_name": "Strassengezwitscher/Strassengezwitscher", "path": "crowdgezwitscher/base/tests/test_models.py", "copies": "1", "size": "6477", "license": "mit", "hash": -1415335242250587400, "line_mean": 31.223880597, "line_max": 89, "alpha_frac": 0.5710977304, "autogenerated": false, "ratio": 3.4...
from django.test import TestCase from rest_framework import pagination, viewsets from rest_framework_extensions.decorators import paginate class TestPaginateDecorator(TestCase): def test_empty_pagination_class(self): msg = "@paginate missing required argument: 'pagination_class'" with self.assert...
{ "repo_name": "chibisov/drf-extensions", "path": "tests_app/tests/unit/decorators/tests.py", "copies": "1", "size": "1537", "license": "mit", "hash": 7614630006130697000, "line_mean": 39.4473684211, "line_max": 110, "alpha_frac": 0.7000650618, "autogenerated": false, "ratio": 4.685975609756097, ...
from django.test import TestCase from rest_framework import status from rest_framework.response import Response from rest_framework.test import APIRequestFactory from rest_framework.viewsets import GenericViewSet factory = APIRequestFactory() class BasicViewSet(GenericViewSet): def list(self, request, *args, **...
{ "repo_name": "hnarayanan/django-rest-framework", "path": "tests/test_viewsets.py", "copies": "5", "size": "1240", "license": "bsd-2-clause", "hash": 8590283206184764000, "line_mean": 34.4285714286, "line_max": 79, "alpha_frac": 0.6241935484, "autogenerated": false, "ratio": 4.261168384879725, ...
from django.test import TestCase from rest_framework import status from rest_framework.test import APIRequestFactory, force_authenticate from api.factories import UserFactory from api.models import User from api.serializers import UserSerializer from api.views.users import UserViewSet class UserApiTest(TestCase): ...
{ "repo_name": "frostblooded/kanq", "path": "api/tests/test_user_api.py", "copies": "1", "size": "2856", "license": "mit", "hash": -8914349205540893000, "line_mean": 38.6666666667, "line_max": 80, "alpha_frac": 0.6666666667, "autogenerated": false, "ratio": 3.6851612903225806, "config_test": tru...
from django.test import TestCase from rest_framework.parsers import JSONParser from rest_framework.request import Request from rest_framework.test import APIRequestFactory from mock_api.response_rules import (RequestParamExistsMatcher, RequestParamContainsValueMatcher, RequestParam...
{ "repo_name": "marcin-bakowski-dev/rest-api-mock-server", "path": "mock_rest_app/mock_api/tests/test_rule_matchers.py", "copies": "1", "size": "3748", "license": "mit", "hash": 464377015677496060, "line_mean": 48.3157894737, "line_max": 117, "alpha_frac": 0.7161152615, "autogenerated": false, "ra...
from django.test import TestCase from rest_framework.permissions import AllowAny from rest_framework.renderers import CoreJSONRenderer from rest_framework.request import Request from rest_framework.test import APIRequestFactory from rest_framework_swagger import renderers from rest_framework_swagger.views import get_s...
{ "repo_name": "pombredanne/django-rest-swagger", "path": "tests/test_views.py", "copies": "2", "size": "3134", "license": "bsd-2-clause", "hash": 2716042783349260300, "line_mean": 32.6989247312, "line_max": 75, "alpha_frac": 0.6311423101, "autogenerated": false, "ratio": 4.173102529960053, "con...
from django.test import TestCase from rest_framework.renderers import JSONRenderer from periods import models as period_models from periods.serializers import FlowEventSerializer, NullableEnumField from periods.tests.factories import FlowEventFactory class TestNullableEnumField(TestCase): def test_to_internal_v...
{ "repo_name": "jessamynsmith/eggtimer-server", "path": "periods/tests/test_serializers.py", "copies": "1", "size": "1164", "license": "mit", "hash": -4519376734248293000, "line_mean": 30.4594594595, "line_max": 97, "alpha_frac": 0.7036082474, "autogenerated": false, "ratio": 3.9060402684563758, ...
from django.test import TestCase from rest_framework.request import Request from rest_framework.test import APIRequestFactory from mock_api.models import ApiEndpoint from mock_api.response_rules import response_rules_provider from mock_api.response_rules.resolvers import ResponseResolver class ResponseResolverTest(T...
{ "repo_name": "marcin-bakowski-dev/rest-api-mock-server", "path": "mock_rest_app/mock_api/tests/test_resolvers.py", "copies": "1", "size": "1186", "license": "mit", "hash": -8070149462002380000, "line_mean": 34.9393939394, "line_max": 114, "alpha_frac": 0.7352445194, "autogenerated": false, "rati...
from django.test import TestCase from rest_framework.reverse import reverse class AlliesTestCase(TestCase): fixtures = [ 'allies.json', 'series.json' ] def test_ally_list(self): resp = self.client.get(reverse('api:v1:ally-list')) self.assertEqual(resp.status_code, 200) ...
{ "repo_name": "reiniervdwindt/power-rangers-api", "path": "src/api/v1/allies/tests.py", "copies": "1", "size": "1092", "license": "mit", "hash": -1108211263387328000, "line_mean": 30.2, "line_max": 116, "alpha_frac": 0.6465201465, "autogenerated": false, "ratio": 3.627906976744186, "config_test...
from django.test import TestCase from rest_framework.reverse import reverse class CiviliansTestCase(TestCase): fixtures = [ 'civilians.json', 'series.json', ] def test_civilian_list(self): resp = self.client.get(reverse('api:v1:civilian-list')) self.assertEqual(resp.statu...
{ "repo_name": "reiniervdwindt/power-rangers-api", "path": "src/api/v1/civilians/tests.py", "copies": "1", "size": "1127", "license": "mit", "hash": 6066438224304088000, "line_mean": 31.2, "line_max": 111, "alpha_frac": 0.6601597161, "autogenerated": false, "ratio": 3.404833836858006, "config_te...
from django.test import TestCase from rest_framework.reverse import reverse class MonstersTestCase(TestCase): fixtures = [ 'monsters.json', 'series.json', ] def test_monster_list(self): resp = self.client.get(reverse('api:v1:monster-list')) self.assertEqual(resp.status_co...
{ "repo_name": "reiniervdwindt/power-rangers-api", "path": "src/api/v1/monsters/tests.py", "copies": "1", "size": "1106", "license": "mit", "hash": -672186609433388700, "line_mean": 30.6, "line_max": 109, "alpha_frac": 0.6555153707, "autogenerated": false, "ratio": 3.6026058631921822, "config_te...
from django.test import TestCase from rest_framework.reverse import reverse class ZordsTestCase(TestCase): fixtures = [ 'rangers.json', 'series.json', 'weapons.json', 'zords.json', ] def test_zord_list(self): resp = self.client.get(reverse('api:v1:zord-list')) ...
{ "repo_name": "reiniervdwindt/power-rangers-api", "path": "src/api/v1/zords/tests.py", "copies": "1", "size": "1202", "license": "mit", "hash": 8544900609617019000, "line_mean": 29.05, "line_max": 83, "alpha_frac": 0.6331114809, "autogenerated": false, "ratio": 3.4739884393063583, "config_test"...
from django.test import TestCase from rest_framework.test import APIClient from django.core.urlresolvers import reverse from .models import User from .serializers import UserSerializer class UserTestCase(TestCase): def setUp(self): self.client = APIClient() def test_api_can_create_user(self): ...
{ "repo_name": "tassolom/twq-app", "path": "api/users/tests.py", "copies": "1", "size": "2311", "license": "mit", "hash": 4045950015923068400, "line_mean": 32.4927536232, "line_max": 95, "alpha_frac": 0.6183470359, "autogenerated": false, "ratio": 3.7334410339256867, "config_test": true, "has_...
from django.test import TestCase from rest_framework.test import APIRequestFactory, force_authenticate from api import factories from api.serializers import UserSerializer from api.views.users import UserViewSet class SignupTest(TestCase): PASSWORD = 'test' REQUIRED_FIELD_ERROR = 'This field is required.' ...
{ "repo_name": "frostblooded/kanq", "path": "api/tests/test_signup.py", "copies": "1", "size": "1745", "license": "mit", "hash": -6534116733013022000, "line_mean": 38.6590909091, "line_max": 79, "alpha_frac": 0.6796561605, "autogenerated": false, "ratio": 4.105882352941176, "config_test": true, ...
from django.test import TestCase from rest_framework.test import APIRequestFactory from django.core.urlresolvers import reverse from rest_framework import status from rest_framework.test import APITestCase from translation_server.models import * from django.urls.exceptions import NoReverseMatch from django.apps import ...
{ "repo_name": "gdelnegro/django-translation-server", "path": "translation_server/tests.py", "copies": "1", "size": "9048", "license": "mit", "hash": 6690100533004134000, "line_mean": 38, "line_max": 123, "alpha_frac": 0.5901856764, "autogenerated": false, "ratio": 4.237939110070258, "config_tes...
from django.test import TestCase from rest_framework.test import APIRequestFactory from rest_framework.test import force_authenticate from common.factories import UserFactory from contacts import factories from contacts.api import serializers from contacts.api import views from contacts.models import LogEntry class T...
{ "repo_name": "phildini/logtacts", "path": "contacts/tests/test_api_views.py", "copies": "1", "size": "9302", "license": "mit", "hash": 490221723418205060, "line_mean": 35.4784313725, "line_max": 70, "alpha_frac": 0.6157815524, "autogenerated": false, "ratio": 4.02858380251191, "config_test": t...
from django.test import TestCase from rest_framework.test import APITestCase from django.core.urlresolvers import reverse from django.contrib.auth.models import User from django.template.loader import render_to_string from models import Server from magpie.models import VPNApplication class ServerTestCase(TestCase): ...
{ "repo_name": "hugoatease/magpie-django", "path": "magpie/servers/tests.py", "copies": "1", "size": "4150", "license": "apache-2.0", "hash": 4212459094640792600, "line_mean": 33.5916666667, "line_max": 109, "alpha_frac": 0.6139759036, "autogenerated": false, "ratio": 3.7421100090171326, "config...
from django.test import TestCase from rest_framework.test import APITestCase from rest_framework import status from charity.models import * from account.models import * from django.contrib.auth.models import User import json class CharityTestCase(TestCase): def setUp(self): Charity.objects.create( ...
{ "repo_name": "linkingcharities/linkingcharities", "path": "Linking_Charities/charity/tests.py", "copies": "1", "size": "11875", "license": "mit", "hash": -1696146677561729000, "line_mean": 47.0769230769, "line_max": 138, "alpha_frac": 0.5786105263, "autogenerated": false, "ratio": 3.875652741514...
from django.test import TestCase from rest_framework.test import APITestCase from rest_framework import status from .models import Template class TemplateTest(APITestCase): fixtures = ['fixtures/user.json', 'fixtures/member.json', 'fixtures/progress.json'] def test_create_template(self): ...
{ "repo_name": "kaqfa/supervise_backend", "path": "progress/tests.py", "copies": "1", "size": "4815", "license": "apache-2.0", "hash": 505845135167013100, "line_mean": 40.1538461538, "line_max": 92, "alpha_frac": 0.6413291796, "autogenerated": false, "ratio": 3.7296669248644463, "config_test": t...
# from django.test import TestCase from rest_framework.test import APITestCase from rest_framework import status class UserRegister(APITestCase): def test_user_register(self): response = self.client.post('/api/v1/auth/register/', {'username': 'mr_nganya', 'email': 'mrnganya@gmail.com', ...
{ "repo_name": "andela-akiura/khali", "path": "api_v1/tests/test_api.py", "copies": "1", "size": "7123", "license": "mit", "hash": -7189888366718536000, "line_mean": 49.8785714286, "line_max": 79, "alpha_frac": 0.4830829707, "autogenerated": false, "ratio": 4.405071119356833, "config_test": true...
from django.test import TestCase from .rule_based import * class TestEasyRuleBased(TestCase): def test_always_moves_to_winning_square_horizontal(self): """ Should always move to a square that wins if possible """ board = [ 0, 1, 1, 2, 2, 0, 0, 0,...
{ "repo_name": "samredway/ttt_project", "path": "tic_tac_toe/app/brain/test_rule_based.py", "copies": "1", "size": "3157", "license": "mit", "hash": -3310638253465150500, "line_mean": 26.2155172414, "line_max": 77, "alpha_frac": 0.5020589167, "autogenerated": false, "ratio": 3.6624129930394433, ...
from django.test import TestCase from satchmo.contact.forms import ContactInfoForm from satchmo.contact.models import * from satchmo.l10n.models import Country from satchmo.shop.models import Config import datetime class ContactTest(TestCase): fixtures = ['l10n-data.yaml', 'test-config.yaml'] def setUp(se...
{ "repo_name": "sankroh/satchmo", "path": "satchmo/contact/tests.py", "copies": "2", "size": "9363", "license": "bsd-3-clause", "hash": 8791240632772698000, "line_mean": 49.3387096774, "line_max": 146, "alpha_frac": 0.607818007, "autogenerated": false, "ratio": 3.382586705202312, "config_test": ...
from django.test import TestCase from search.models import BookCategory, Book, DatesMixin class ModelsTestCase(TestCase): """Test suite for the models.""" def setUp(self): """Setup variables.""" self.title = "Harry Porter and the Goblet of Fire" self.category_name = "Adventure" ...
{ "repo_name": "gitgik/booksearch", "path": "search/tests/test_models.py", "copies": "1", "size": "1648", "license": "mit", "hash": -7103616877712461000, "line_mean": 38.2380952381, "line_max": 66, "alpha_frac": 0.6601941748, "autogenerated": false, "ratio": 3.9238095238095236, "config_test": tr...
from django.test import TestCase from sendinel.backend.output import VoiceOutputData, SMSOutputData, \ BluetoothOutputData, OutputData from sendinel.backend import bluetooth, voicecall class OutputTest(TestCase): def setUp(self): pass def test_implementatio...
{ "repo_name": "Sendinel/Sendinel", "path": "sendinel/backend/tests/output_test.py", "copies": "1", "size": "1945", "license": "mit", "hash": 607277004105037200, "line_mean": 35.0185185185, "line_max": 77, "alpha_frac": 0.636503856, "autogenerated": false, "ratio": 4.112050739957716, "config_tes...
from django.test import TestCase from sensordatainterface.models import SamplingFeature, Method, Action, FeatureAction, EquipmentUsed from django.test import RequestFactory from sensordatainterface.views import SiteVisitsBySite from django.db.models import Q import datetime import helper_classes class TestSiteVisitsBy...
{ "repo_name": "UCHIC/ODM2Sensor", "path": "src/sensordatainterface/tests/test_siteVisitsBySite.py", "copies": "1", "size": "5177", "license": "bsd-3-clause", "hash": 1424674419147729700, "line_mean": 37.0735294118, "line_max": 100, "alpha_frac": 0.6202433842, "autogenerated": false, "ratio": 4.35...
from django.test import TestCase from sensordatainterface.urls import lists_urls, detail_urls from sensordatainterface.views.detail_views import DeploymentDetail from sensordatainterface.models import Sites, Action, EquipmentModel, SamplingFeature, SpatialReference, \ FeatureAction, Method, People, Organization, Eq...
{ "repo_name": "UCHIC/ODM2Sensor", "path": "src/sensordatainterface/tests/test_urls.py", "copies": "1", "size": "74824", "license": "bsd-3-clause", "hash": -8682060319216449000, "line_mean": 36.7142137097, "line_max": 126, "alpha_frac": 0.5919090132, "autogenerated": false, "ratio": 4.455666051330...
from django.test import TestCase from .serializers import FilterSerializer from .models import Filter, FacebookPage # Create your tests here. class SerializersTests(TestCase): fixtures = ['single_user.json'] def test_filter_creation_and_update(self): """ By creating the filter the FacebookPage...
{ "repo_name": "nice-shot/FacebookFilter", "path": "feed_filter/tests.py", "copies": "1", "size": "1476", "license": "mit", "hash": 3284539232150074400, "line_mean": 36.8461538462, "line_max": 74, "alpha_frac": 0.5460704607, "autogenerated": false, "ratio": 4.205128205128205, "config_test": true...
from django.test import TestCase from server.logic.graph.graph import Graph from server.logic.graph.poison import PoisonedGraph class TestExample(TestCase): """ Example of how to use this graph library Please read this carefully if you're going to work with it. """ """ While this e...
{ "repo_name": "simonneuville/runamic_server", "path": "djangoserver/server/logic/graph/test_example.py", "copies": "1", "size": "2355", "license": "mit", "hash": 1414446231855083800, "line_mean": 35.796875, "line_max": 80, "alpha_frac": 0.5363057325, "autogenerated": false, "ratio": 3.41304347826...
from django.test import TestCase from server.logic.routing.util import ground, unground from server.static.city import GRAPH from server.logic.routing.poison import poison_graph from server.logic.routing.config import from_dict from server.config import DEFAULT_ROUTING_CONFIG from server.logic.routing.compress import i...
{ "repo_name": "simonneuville/runamic_server", "path": "djangoserver/server/logic/routing/tests.py", "copies": "1", "size": "1703", "license": "mit", "hash": 3273518737368416000, "line_mean": 38.6046511628, "line_max": 113, "alpha_frac": 0.6688197299, "autogenerated": false, "ratio": 3.53319502074...
from django.test import TestCase from server.static.city import GRAPH, GRID from server.logic.distance.util import get_closest_edge from server.logic.projection.util import Projection TEST_COUNT = 100 class ClosestTestCase(TestCase): """ Class for testing whether the get_closest_edge functions work "...
{ "repo_name": "simonneuville/runamic_server", "path": "djangoserver/server/logic/distance/tests.py", "copies": "1", "size": "1862", "license": "mit", "hash": -4447921576101784000, "line_mean": 36.24, "line_max": 87, "alpha_frac": 0.5429645542, "autogenerated": false, "ratio": 4.300230946882217, ...
from django.test import TestCase from services.mgmt import get_available_services, available_services class ServicesManagement(TestCase): def test_get_available_services(self): # Check that all services are returned by get_available_services() when no further parameters are given for service in ...
{ "repo_name": "AudioCommons/ac-mediator", "path": "services/tests.py", "copies": "1", "size": "1605", "license": "apache-2.0", "hash": -339811995220692540, "line_mean": 47.6363636364, "line_max": 119, "alpha_frac": 0.7133956386, "autogenerated": false, "ratio": 4.665697674418604, "config_test":...
from django.test import TestCase from settings.test import SELENIUM_DRIVER from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC import unittest class MainTestCase(unittest.TestCase): def setUp(self): ...
{ "repo_name": "aaronsnig501/foreign-guides", "path": "apps/accounts/tests.py", "copies": "1", "size": "1257", "license": "mit", "hash": 7496208377199070000, "line_mean": 33.9444444444, "line_max": 72, "alpha_frac": 0.6738265712, "autogenerated": false, "ratio": 3.5914285714285716, "config_test"...
from django.test import TestCase from six import StringIO from django.core.management import call_command from algoliasearch_django import algolia_engine from algoliasearch_django import get_adapter from algoliasearch_django import clear_index from .models import Website from .models import User class CommandsTestC...
{ "repo_name": "algolia/algoliasearch-django", "path": "tests/test_commands.py", "copies": "1", "size": "4140", "license": "mit", "hash": -6374796973465878000, "line_mean": 29.4411764706, "line_max": 75, "alpha_frac": 0.604589372, "autogenerated": false, "ratio": 4.4089456869009584, "config_test...
from django.test import TestCase from six.moves import mock from .. import factories, fixtures from waldur_core.structure import models as structure_models class LogProjectSaveTest(TestCase): @mock.patch('waldur_core.structure.handlers.event_logger') def test_logger_called_once_on_project_create(self, logg...
{ "repo_name": "opennode/nodeconductor", "path": "waldur_core/structure/tests/unittests/test_handlers.py", "copies": "1", "size": "5675", "license": "mit", "hash": -155304472840759900, "line_mean": 40.4233576642, "line_max": 108, "alpha_frac": 0.5674008811, "autogenerated": false, "ratio": 4.40263...
from django.test import TestCase from Snooker.models import Strike, Player, Frame, Match from django.core.exceptions import ValidationError def basicSetUp(obj): obj.player1 = Player() obj.player1.name = "P1" obj.player1.save() obj.player2 = Player() obj.player2.name = "P2" obj.player2.save() ...
{ "repo_name": "RedBulli/Django_SnookerStats", "path": "Snooker/tests/models.py", "copies": "1", "size": "4648", "license": "bsd-3-clause", "hash": -4378686679523793000, "line_mean": 31.9645390071, "line_max": 82, "alpha_frac": 0.6402753873, "autogenerated": false, "ratio": 3.4583333333333335, "...
from django.test import TestCase from snowbird.datamap import DataMap, DataJob from snowbird.io import DjangoModel from snowbird.tests.datamaps import TestModelDataMap from snowbird.tests.models import TestModel2 from django.test.utils import setup_test_environment setup_test_environment() class TestDataMap(TestCase...
{ "repo_name": "unbracketed/snowbird", "path": "snowbird/tests/test_datamaps.py", "copies": "1", "size": "1288", "license": "mit", "hash": 3934534749735136000, "line_mean": 28.2727272727, "line_max": 63, "alpha_frac": 0.6242236025, "autogenerated": false, "ratio": 3.3717277486910993, "config_tes...
from django.test import TestCase from soothsayer.classifiers import RandomForestModel import numpy as np from soothsayer.tests.common import get_binary_labeled_data class BinaryClassifierTest(TestCase): def setUp(self): labeled_data = get_binary_labeled_data() feature_names = [] for ent...
{ "repo_name": "shawnhermans/soothsayer", "path": "soothsayer/tests/test_binary_classifier.py", "copies": "1", "size": "4184", "license": "bsd-3-clause", "hash": 2463928691517862400, "line_mean": 35.0775862069, "line_max": 101, "alpha_frac": 0.5771988528, "autogenerated": false, "ratio": 3.8036363...
from django.test import TestCase from sso import permissions from django.contrib.auth.models import User, Group from unicoresso.models import AuthorizedSite class customAttributesTest(TestCase): def test_group_access(self): user = User.objects.create(first_name='foo') attr = permissions.custom_at...
{ "repo_name": "universalcore/unicore-hub", "path": "unicoresso/tests/test_permissions.py", "copies": "1", "size": "4142", "license": "bsd-2-clause", "hash": -4859829149836076000, "line_mean": 36.3153153153, "line_max": 78, "alpha_frac": 0.6163689039, "autogenerated": false, "ratio": 3.51314673452...
from django.test import TestCase from stalku.core.management.commands._lectures import crawl_institutes, crawl_lectures_grad, crawl_lecture_grad from stalku.core.management.commands._students import get_students_for_lecture_instance from stalku.core.models import Lecture, Institute, LectureInstance class LectureCrawl...
{ "repo_name": "henriquenogueira/stalku", "path": "stalku/core/tests/test_crawlers.py", "copies": "1", "size": "2359", "license": "mit", "hash": -7515046009057704000, "line_mean": 36.380952381, "line_max": 118, "alpha_frac": 0.5927813163, "autogenerated": false, "ratio": 3.5574018126888216, "con...
from django.test import TestCase from status_app.dispatcher.memory import get_all_events, clear_all_events from status_app.receiver_initialization import load_receivers from django.core.exceptions import ImproperlyConfigured from django.test.client import Client import contextlib class ReceiverTest(TestCase): def...
{ "repo_name": "vegitron/status-app", "path": "status_app/test/receiver.py", "copies": "1", "size": "1369", "license": "apache-2.0", "hash": 863014358288446500, "line_mean": 40.5151515152, "line_max": 112, "alpha_frac": 0.6515704894, "autogenerated": false, "ratio": 4.473856209150327, "config_te...
from django.test import TestCase from status_app.dispatcher.model import dispatch from status_app.models import EventBucket, RawEvent from django.utils import timezone class PassFailTest(TestCase): def test_one_pass(self): dispatch('pft_test_one_pass', RawEvent.PASS_FAIL, timezone.now(), True, '', 'test') ...
{ "repo_name": "vegitron/status-app", "path": "status_app/test/dispatcher.py", "copies": "1", "size": "3850", "license": "apache-2.0", "hash": 755656972527051900, "line_mean": 49, "line_max": 135, "alpha_frac": 0.6706493506, "autogenerated": false, "ratio": 3.4131205673758864, "config_test": tru...
from django.test import TestCase from store.models import Store from django.core.urlresolvers import reverse from rest_framework.test import APITestCase from rest_framework import status from rest_framework.test import APIClient from django.contrib.auth.models import User class AccountTests(APITestCase, TestCase): ...
{ "repo_name": "smillerpy/shoes", "path": "super_shoes/store/tests/tests_rest.py", "copies": "1", "size": "1876", "license": "mit", "hash": 6037020208494186000, "line_mean": 38.914893617, "line_max": 83, "alpha_frac": 0.6545842217, "autogenerated": false, "ratio": 3.868041237113402, "config_test...
from django.test import TestCase from suite.forms import RegistrationForm,ClubCreateForm,EventCreateForm,EditProfileForm from django.contrib.auth import get_user_model from django.contrib.auth.hashers import check_password from django.test import Client from suite.models import Club,Division,User class RegistrationFor...
{ "repo_name": "fsxfreak/club-suite", "path": "clubsuite/suite/tests/test_forms.py", "copies": "1", "size": "4355", "license": "mit", "hash": 221773068101137600, "line_mean": 37.201754386, "line_max": 107, "alpha_frac": 0.5249138921, "autogenerated": false, "ratio": 4.19153031761309, "config_tes...
from django.test import TestCase from suite.models import Club from django.contrib.auth import get_user_model from suite.models import JoinRequest class JoinRequestTestCase(TestCase): def setUp(self): #create club owner self.owner=get_user_model().objects.create(first_name="Owner",last_name="McPe...
{ "repo_name": "fsxfreak/club-suite", "path": "clubsuite/suite/tests/test_mdl_joinrequest.py", "copies": "1", "size": "1148", "license": "mit", "hash": 1335373619459400000, "line_mean": 37.2666666667, "line_max": 113, "alpha_frac": 0.7038327526, "autogenerated": false, "ratio": 3.5652173913043477,...
from django.test import TestCase from suite.models import Club from suite.models import Budget from suite.models import Division from django.contrib.auth import get_user_model class BudgetTestCase(TestCase): def setUp(self): #Create club self.club=Club.objects.create(club_name="club",club_type="P...
{ "repo_name": "fsxfreak/club-suite", "path": "clubsuite/suite/tests/test_mdl_budget.py", "copies": "1", "size": "1248", "license": "mit", "hash": 6006483662798823000, "line_mean": 43.5714285714, "line_max": 117, "alpha_frac": 0.7067307692, "autogenerated": false, "ratio": 3.135678391959799, "co...
from django.test import TestCase from survey.forms.question_module_form import QuestionModuleForm from survey.models import QuestionModule class QuestionModuleFormTest(TestCase): def test_valid(self): form_data = { 'name': 'Education', } question_module_form = QuestionModuleFo...
{ "repo_name": "unicefuganda/uSurvey", "path": "survey/tests/forms/test_question_module_form.py", "copies": "1", "size": "2081", "license": "bsd-3-clause", "hash": 7133321200218728000, "line_mean": 51.05, "line_max": 124, "alpha_frac": 0.6472849592, "autogenerated": false, "ratio": 4.2556237218813...
from django.test import TestCase from survey.models import ResponseValidation, TestArgument, TextArgument from survey.models.response_validation import NumberArgument, DateArgument class ResponseValidationTest(TestCase): def test_fields(self): rvt = ResponseValidation() fields = [str(item.attname...
{ "repo_name": "unicefuganda/uSurvey", "path": "survey/tests/models/test_response_validation.py", "copies": "1", "size": "4085", "license": "bsd-3-clause", "hash": 3851990253944124000, "line_mean": 37.9142857143, "line_max": 109, "alpha_frac": 0.6678090575, "autogenerated": false, "ratio": 3.80708...
from django.test import TestCase from survey.models.locations import * from survey.utils.views_helper import contains_key, get_descendants, get_ancestors, clean_query_params, prepend_to_keys class ViewsHelperTest(TestCase): def test_contains_key(self): self.assertTrue(contains_key({'bla': '1'}, 'bla')) ...
{ "repo_name": "unicefuganda/uSurvey", "path": "survey/tests/utils/test_views_helper.py", "copies": "1", "size": "7986", "license": "bsd-3-clause", "hash": 6841801498728483000, "line_mean": 55.2464788732, "line_max": 119, "alpha_frac": 0.6384923616, "autogenerated": false, "ratio": 3.4767087505441...
from django.test import TestCase from survey.tests.base_test import BaseTest from survey.models.locations import LocationType, Location class LocationTest(TestCase): def test_fields(self): ss_content = Location() fields = [str(item.attname) for item in ss_content._meta.fields] self.assert...
{ "repo_name": "unicefuganda/uSurvey", "path": "survey/tests/models/test_location_model.py", "copies": "1", "size": "2865", "license": "bsd-3-clause", "hash": -383483216859443600, "line_mean": 46.7666666667, "line_max": 116, "alpha_frac": 0.6495636998, "autogenerated": false, "ratio": 3.7450980392...
from django.test import TestCase from taggit.models import Tag from .taggit_extras.models import Food class NamespacedTaggableManagerTest(TestCase): food_model = Food def assert_tags_equal(self, qs, tags, attr="name"): got = sorted(getattr(tag, attr) for tag in qs) self.assertEqual(got, sort...
{ "repo_name": "Elchi3/kuma", "path": "kuma/core/tests/test_taggit_extras.py", "copies": "3", "size": "3098", "license": "mpl-2.0", "hash": 8181727979391478000, "line_mean": 34.2045454545, "line_max": 79, "alpha_frac": 0.5703679793, "autogenerated": false, "ratio": 3.1709314227226204, "config_te...
from django.test import TestCase from talk.views import Translate import mock import random import unittest from django.core.urlresolvers import reverse from rest_framework import status from rest_framework.test import APITestCase class TestAPI(APITestCase): def test_post(self): """ Ensure we can ...
{ "repo_name": "keymholio/kraang_api", "path": "talk/tests.py", "copies": "1", "size": "8765", "license": "mit", "hash": 318447335152388860, "line_mean": 41.1394230769, "line_max": 131, "alpha_frac": 0.6316029663, "autogenerated": false, "ratio": 3.5848670756646217, "config_test": true, "has_n...
from django.test import TestCase from taskmaster.models import * class DependencyTestCase(TestCase): def setUp(self): self.group = JobGroup.objects.create(name="pizza maker group") self.job1 = self.group.new_job(name="tony job") self.job2 = self.group.new_job(name="steve job") self.job3 = self.group.new_job(n...
{ "repo_name": "ChrisCooper/pipeline-nanny", "path": "taskmaster/tests.py", "copies": "1", "size": "2296", "license": "mit", "hash": 6669829057270658000, "line_mean": 37.9322033898, "line_max": 91, "alpha_frac": 0.7395470383, "autogenerated": false, "ratio": 2.9511568123393315, "config_test": tr...
from django.test import TestCase from tastypie.contrib.contenttypes.fields import GenericForeignKeyField from tastypie.bundle import Bundle from content_gfk.models import Note, Quote, Rating, Definition from content_gfk.api.resources import NoteResource, DefinitionResource, \ QuoteResource, RatingResource class C...
{ "repo_name": "11craft/django-tastypie", "path": "tests/content_gfk/tests/fields.py", "copies": "2", "size": "2775", "license": "bsd-3-clause", "hash": -5021282082484829000, "line_mean": 32.4337349398, "line_max": 89, "alpha_frac": 0.6154954955, "autogenerated": false, "ratio": 4.249617151607963,...
from django.test import TestCase from taxon_checker.models import Query, GBIFResponse from taxon_checker.api_utils import species_search, process_response class GBIFNameQueryTest(TestCase): valid_names = { 'matchtype': 'exact', 'names': [ 'Acacia acuminata', 'Eucalyptus ma...
{ "repo_name": "chidg/django-triodia", "path": "triodia/tests.py", "copies": "1", "size": "1625", "license": "mit", "hash": 3160056379127337500, "line_mean": 30.862745098, "line_max": 89, "alpha_frac": 0.5335384615, "autogenerated": false, "ratio": 4.002463054187192, "config_test": false, "has...
from django.test import TestCase from teams.models import Team, Membership from users.models import User from django.utils import timezone from django.core.exceptions import ValidationError class Membership_test(TestCase): def setUp(self): self.user_email = "test@example.com" self.user_password = "...
{ "repo_name": "buildbuild/buildbuild", "path": "buildbuild/teams/tests/test_membership.py", "copies": "1", "size": "1822", "license": "bsd-3-clause", "hash": -8496449089594190000, "line_mean": 24.3055555556, "line_max": 75, "alpha_frac": 0.5817782656, "autogenerated": false, "ratio": 4.2570093457...
from django.test import TestCase from teams.models import Team from projects.models import Project, ProjectMembership from buildbuild import attributes_for_tests class Membership_team_to_member_test(TestCase): fixtures = ['properties_data.yaml'] def setUp(self): self.team_name = "Team1" self.se...
{ "repo_name": "buildbuild/buildbuild", "path": "buildbuild/projects/tests/test_project_membership_team_to_project.py", "copies": "1", "size": "2158", "license": "bsd-3-clause", "hash": 8532955957399143000, "line_mean": 33.253968254, "line_max": 86, "alpha_frac": 0.6269694161, "autogenerated": false...
from django.test import TestCase from teams.models import Team from projects.models import Project, ProjectWaitList from django.utils import timezone from buildbuild import attributes_for_tests class project_manager_test(TestCase): fixtures = ['properties_data.yaml'] def setUp(self): self.team_name =...
{ "repo_name": "buildbuild/buildbuild", "path": "buildbuild/projects/tests/test_project_wait_list_project_to_team.py", "copies": "1", "size": "1752", "license": "bsd-3-clause", "hash": -1013229529853228300, "line_mean": 31.4444444444, "line_max": 82, "alpha_frac": 0.6067351598, "autogenerated": fals...
from django.test import TestCase from teams.models import Team,TeamManager from django.core.exceptions import ValidationError, ObjectDoesNotExist class TestTeamManager(TestCase): def setUp(self): self.team = Team() self.team.name = "firstTeam" self.valid_team_name = "TeamTeam-_0" s...
{ "repo_name": "buildbuild/buildbuild", "path": "buildbuild/teams/tests/test_team_manager.py", "copies": "1", "size": "3333", "license": "bsd-3-clause", "hash": -4316232053358401500, "line_mean": 31.6764705882, "line_max": 87, "alpha_frac": 0.5811581158, "autogenerated": false, "ratio": 4.10467980...
from django.test import TestCase from teams.models import Team, WaitList from users.models import User from django.utils import timezone from django.core.exceptions import ValidationError class WaitList_wait_member_to_team_test(TestCase): def setUp(self): self.user_email = "test@example.com" self.u...
{ "repo_name": "buildbuild/buildbuild", "path": "buildbuild/teams/tests/test_wait_list_wait_member_to_team.py", "copies": "1", "size": "1509", "license": "bsd-3-clause", "hash": 3795934060167214600, "line_mean": 29.7959183673, "line_max": 80, "alpha_frac": 0.6010603048, "autogenerated": false, "ra...
from django.test import TestCase from test_app.models import MonitorAllFields, MonitorSomeFields class MonitoredModelGetChanges(TestCase): def test_monitor_all_fields_no_changes___result_is_empty_dict(self): m = MonitorAllFields(first_field=1) self.assertEqual({}, m.get_changes()) def test_m...
{ "repo_name": "OmegaDroid/django-model-monitor", "path": "src/test_app/test/unit/test_monitored_model_get_changes.py", "copies": "1", "size": "1523", "license": "mit", "hash": 6593055086593782000, "line_mean": 36.1707317073, "line_max": 119, "alpha_frac": 0.6349310571, "autogenerated": false, "ra...
from django.test import TestCase from timecode import Timecode from .models import TestModel class TimecodeTest(TestCase): def test_creation(self): self.assertRaises(ValueError, Timecode, '00:00:00:00:00') self.assertRaises(ValueError, Timecode, '00:00:00000') self.assertRaises(ValueError,...
{ "repo_name": "joerick/django-timecode", "path": "timecode/test/tests.py", "copies": "1", "size": "2096", "license": "bsd-3-clause", "hash": -1155077550356828200, "line_mean": 28.1111111111, "line_max": 100, "alpha_frac": 0.5997137405, "autogenerated": false, "ratio": 2.994285714285714, "config...
from django.test import TestCase from tutorials.models import Category, Tutorial class MyUnitTest(TestCase): fixtures = ['tests'] def check_templates_in_use(self, location, **kwargs): expected_status_code = kwargs.pop("status_code", 200) response = self.client.get(location) self.asse...
{ "repo_name": "d0ntreadthis/tutorials_site", "path": "tutorials/tests/test_views.py", "copies": "1", "size": "4386", "license": "mit", "hash": 7692174771176343000, "line_mean": 39.9906542056, "line_max": 78, "alpha_frac": 0.6673506612, "autogenerated": false, "ratio": 3.8507462686567164, "confi...
from django.test import TestCase from unittest2 import skipIf from django.db import connection import json from datetime import datetime from dateutil import parser from django.utils import timezone from sqlshare_rest.util.db import get_backend from sqlshare_rest.test import missing_url from django.test.utils import ov...
{ "repo_name": "uw-it-aca/sqlshare-rest", "path": "sqlshare_rest/test/api/snapshot.py", "copies": "1", "size": "3624", "license": "apache-2.0", "hash": 7293206166251414000, "line_mean": 41.1395348837, "line_max": 219, "alpha_frac": 0.6476269316, "autogenerated": false, "ratio": 4.1895953757225435,...
from django.test import TestCase from unittest2 import skipIf from django.db import connection import json import re from sqlshare_rest.util.db import get_backend from sqlshare_rest.test import missing_url from sqlshare_rest.models import Query from sqlshare_rest.util.query_queue import process_queue from django.test.u...
{ "repo_name": "uw-it-aca/sqlshare-rest", "path": "sqlshare_rest/test/api/query.py", "copies": "1", "size": "3447", "license": "apache-2.0", "hash": 8158915742868783000, "line_mean": 41.0365853659, "line_max": 149, "alpha_frac": 0.6214099217, "autogenerated": false, "ratio": 3.934931506849315, "...
# from django.test import TestCase from unittest import TestCase, main import doctest import pip installed_packages = pip.get_installed_distributions() installed_packages_list = sorted(["%s==%s" % (i.key, i.version) for i in installed_packages]) print('Available packages for import!!!!!!!!!') print(installed_packages_l...
{ "repo_name": "hobson/pug-dj", "path": "pug/dj/tests.py", "copies": "1", "size": "1083", "license": "mit", "hash": -4283975313460928500, "line_mean": 35.1333333333, "line_max": 145, "alpha_frac": 0.6371191136, "autogenerated": false, "ratio": 3.6587837837837838, "config_test": true, "has_no_k...
from django.test import TestCase from unittest.mock import NonCallableMock from silk.collector import DataCollector from silk.middleware import SilkyMiddleware from .util import delete_all_models from silk.config import SilkyConfig from silk.models import Request def fake_get_response(): def fake_response(): ...
{ "repo_name": "jazzband/silk", "path": "project/tests/test_config_meta.py", "copies": "1", "size": "1502", "license": "mit", "hash": -5683191057731156000, "line_mean": 30.2916666667, "line_max": 74, "alpha_frac": 0.6431424767, "autogenerated": false, "ratio": 4.081521739130435, "config_test": t...
from django.test import TestCase from unittest.mock import patch, call from accounts.models import Token import accounts class SendLoginEmailViewTest(TestCase): def send_login_mail_POST(self): return self.client.post('/accounts/send_login_email', data={ 'email':'p.leonard.example@gmail.com' ...
{ "repo_name": "PatrickLeonard/superlists", "path": "accounts/tests/test_views.py", "copies": "1", "size": "3099", "license": "mit", "hash": 5863111289556088000, "line_mean": 36.7926829268, "line_max": 80, "alpha_frac": 0.6369796709, "autogenerated": false, "ratio": 3.693682955899881, "config_te...
from django.test import TestCase from unittest.mock import patch, call from accounts.models import Token class SendLoginEmailViewTest(TestCase): def test_redirects_to_home_page(self): response = self.client.post('/accounts/send_login_email', data={ 'email': 'edith@example.com' }) ...
{ "repo_name": "fantasycheung/django_learning", "path": "accounts/tests/test_views.py", "copies": "1", "size": "3121", "license": "mit", "hash": -3921529697447074300, "line_mean": 32.9239130435, "line_max": 79, "alpha_frac": 0.6344120474, "autogenerated": false, "ratio": 3.6804245283018866, "con...
from django.test import TestCase from unittest.mock import patch, Mock import unittest from lists.models import Item, List from lists.forms import ( DUPLICATE_ITEM_ERROR, EMPTY_ITEM_ERROR, ItemForm, ExistingListItemForm, NewListForm ) class ItemFormTest(TestCase): def test_form_renders_text_input(self):...
{ "repo_name": "migglu/todo-lists", "path": "lists/tests/test_forms.py", "copies": "1", "size": "3111", "license": "mit", "hash": 1569454584881070000, "line_mean": 34.7586206897, "line_max": 79, "alpha_frac": 0.6370941819, "autogenerated": false, "ratio": 3.5152542372881355, "config_test": true,...
from django.test import TestCase from unittest.mock import patch from domain_api.epp.actions.contact import Contact from domain_api.epp.entity import EppRpcClient import re import domain_api class MockRpcClient(domain_api.epp.entity.EppRpcClient): def __init__(self, host=None): pass class TestCreateCont...
{ "repo_name": "heytrav/drs-project", "path": "domain_api/tests/test_epp_actions.py", "copies": "1", "size": "1967", "license": "mit", "hash": 7371442941156475000, "line_mean": 31.2459016393, "line_max": 75, "alpha_frac": 0.4661921708, "autogenerated": false, "ratio": 4.294759825327511, "config_...
from django.test import TestCase from uriredirect.models import RewriteRule, UriRegister, AcceptMapping, MediaType class RewriteRuleTestCase(TestCase): fixtures = ['test_mediatype.json', 'test_uriregister.json', 'test_rewriterule.json', 'test_acceptmapping.json'] def test_content_negotiation_without_mappi...
{ "repo_name": "usgin/uriredirect", "path": "tests/RewriteRuleTestCase.py", "copies": "1", "size": "4923", "license": "bsd-3-clause", "hash": 310621955450813100, "line_mean": 71.4117647059, "line_max": 203, "alpha_frac": 0.7123705058, "autogenerated": false, "ratio": 4.116220735785953, "config_t...
from django.test import TestCase from user.forms import AddPatientForm class TestAddPatientForm(TestCase): def setUp(self): self.form = AddPatientForm self.email_valid = 'teste@teste.com' self.email_invalid = 'teste.com' self.email_invalid_TYPE = 'teste.com' self.email_inv...
{ "repo_name": "fga-gpp-mds/2017.2-Receituario-Medico", "path": "medical_prescription/user/test/test_form_add_patient.py", "copies": "1", "size": "1238", "license": "mit", "hash": -1695259006108941300, "line_mean": 32.4594594595, "line_max": 108, "alpha_frac": 0.6607431341, "autogenerated": false, ...
from django.test import TestCase from .utils import load_json import mock from chatterbox.models import ( Service, Collector, Job, Activity ) class CollectorFacebookWallTestCase(TestCase): fixtures = ('project/apps/chatterbox/fixtures/users.json', 'project/apps/chatterbox/fixtures/dump.json') ...
{ "repo_name": "blitzagency/django-chatterbox", "path": "chatterbox/tests/test_collector_facebook.py", "copies": "1", "size": "1393", "license": "mit", "hash": 8081173705704296000, "line_mean": 31.3953488372, "line_max": 88, "alpha_frac": 0.6288585786, "autogenerated": false, "ratio": 3.9350282485...
from django.test import TestCase from varify.genes.forms import GeneSetBulkForm from vdw.genes.models import Gene, GeneSet from vdw.genome.models import Chromosome class GeneSetBulkFormTestCase(TestCase): def setUp(self): import string chr1 = Chromosome(value='1', label='1') chr1.save() ...
{ "repo_name": "chop-dbhi/varify", "path": "tests/cases/geneset_form/tests.py", "copies": "1", "size": "2659", "license": "bsd-2-clause", "hash": 9197567343079043000, "line_mean": 35.9305555556, "line_max": 107, "alpha_frac": 0.6077472734, "autogenerated": false, "ratio": 3.498684210526316, "con...
from django.test import TestCase from videos.models import Tag from django.db.utils import DataError, IntegrityError class TagTestCase(TestCase): def test_create_tag_content_is_hair(self): '''Asserts that a tag with content "hair" is correctly stored in the database''' CONTENT_TEXT = "hair" ...
{ "repo_name": "rnikiforova/GuruTubeProject", "path": "GuruTube/applications/videos/tests/test_tag.py", "copies": "1", "size": "2188", "license": "bsd-3-clause", "hash": -7113454355519691000, "line_mean": 41.0961538462, "line_max": 95, "alpha_frac": 0.6398537477, "autogenerated": false, "ratio": 3...
from django.test import TestCase from .views import GeographyDetailView class ParseTestCase(TestCase): def setUp(self): self.view = GeographyDetailView() def test_parse_typical(self): """Animals that can speak are correctly identified""" (geoid,slug) = self.view.parse_fragment('16000US...
{ "repo_name": "Ladaniels/censusreporter", "path": "censusreporter/apps/census/tests.py", "copies": "8", "size": "1448", "license": "mit", "hash": -5767508769153780000, "line_mean": 40.3714285714, "line_max": 102, "alpha_frac": 0.6885359116, "autogenerated": false, "ratio": 3.3135011441647597, "...
# from django.test import TestCase from vms.models import IITGUser, StudentVehicle, EmployeeVehicle , Guard, Gate, ParkingSlot, SuspiciousVehicle, ResidentLog, VisitorLog, TheftReport , Place, BusTiming , PersonPass, Day, OnDutyGuard # from datetime import datetime from django.contrib.auth.models import User # """ # S...
{ "repo_name": "cs243iitg/vehicle-webapp", "path": "webapp/vms/tests.py", "copies": "1", "size": "10426", "license": "mit", "hash": -4894903388812146000, "line_mean": 47.7196261682, "line_max": 422, "alpha_frac": 0.669767888, "autogenerated": false, "ratio": 2.583250743310208, "config_test": tru...
from django.test import TestCase from vutman.models import EmailAlias, EmailUser, EmailDomain, EmailServer from django.db import IntegrityError class SimpleTestCase(TestCase): def setUp(self): self.server = EmailServer.objects.create(email_server="server") self.domain = EmailDomain.objects.create(...
{ "repo_name": "daniellawrence/django-vutman", "path": "tests/test_person.py", "copies": "1", "size": "10903", "license": "mit", "hash": 3079291276338711600, "line_mean": 34.284789644, "line_max": 75, "alpha_frac": 0.5961661928, "autogenerated": false, "ratio": 4.080464071856287, "config_test": ...
from django.test import TestCase from wagtailbase.models import (BlogIndexPage, BlogPost, IndexPage, IndexPageRelatedLink, RichTextPage) FIXTURES = ['test_data.json'] class TestRelatedLink(TestCase): fixtures = FIXTURES def setUp(self): self.link = IndexPageRelatedLin...
{ "repo_name": "kingsdigitallab/dprr-django", "path": "wagtailbase/tests/tests.py", "copies": "1", "size": "1717", "license": "mit", "hash": -2239097228846990800, "line_mean": 29.1228070175, "line_max": 73, "alpha_frac": 0.6447291788, "autogenerated": false, "ratio": 3.8155555555555556, "config_...
from django.test import TestCase from wagtail.core.blocks import CharBlock, RichTextBlock from wagtail.images.blocks import ImageChooserBlock from omni_blocks.blocks.list_blocks import OLBlock, ULBlock from omni_blocks.blocks.struct_blocks import FlowBlock, LinkBlock class TestULBlock(TestCase): """Tests for the...
{ "repo_name": "omni-digital/omni-blocks", "path": "tests/test_list_blocks.py", "copies": "1", "size": "3043", "license": "mit", "hash": 298215641046110400, "line_mean": 32.8111111111, "line_max": 99, "alpha_frac": 0.616168255, "autogenerated": false, "ratio": 3.8567807351077312, "config_test": ...
from django.test import TestCase from wagtail.tests.utils import unittest, WagtailTestUtils from wagtail.wagtailsearch import models class TestEditorsPicks(TestCase): def test_editors_pick_create(self): # Create an editors pick to the root page models.EditorsPick.objects.create( query=...
{ "repo_name": "helenwarren/pied-wagtail", "path": "wagtail/wagtailsearch/tests/test_editorspicks.py", "copies": "1", "size": "4247", "license": "bsd-3-clause", "hash": -6827694120896073000, "line_mean": 33.8114754098, "line_max": 111, "alpha_frac": 0.6390393219, "autogenerated": false, "ratio": 3...
from django.test import TestCase from wagtail.tests.utils import WagtailTestUtils from wagtail.wagtailcore.models import Page from wagtail.wagtailadmin.tasks import send_email_task from django.core.urlresolvers import reverse from django.core import mail class TestHome(TestCase, WagtailTestUtils): def setUp(self)...
{ "repo_name": "100Shapes/wagtail", "path": "wagtail/wagtailadmin/tests/tests.py", "copies": "1", "size": "2373", "license": "bsd-3-clause", "hash": 5937742190021798000, "line_mean": 39.2203389831, "line_max": 120, "alpha_frac": 0.6894226717, "autogenerated": false, "ratio": 3.748815165876777, "...
from django.test import TestCase from wagtail.wagtailcore.models import Page, PageViewRestriction class TestPagePrivacy(TestCase): fixtures = ['test.json'] def setUp(self): self.secret_plans_page = Page.objects.get(url_path='/home/secret-plans/') self.view_restriction = PageViewRestriction.ob...
{ "repo_name": "willcodefortea/wagtail", "path": "wagtail/wagtailcore/tests/test_page_privacy.py", "copies": "36", "size": "3488", "license": "bsd-3-clause", "hash": 1420963349684034800, "line_mean": 48.8285714286, "line_max": 141, "alpha_frac": 0.6642775229, "autogenerated": false, "ratio": 3.901...
from django.test import TestCase from wellspring.services import vest_service from django.core.exceptions import ObjectDoesNotExist class VestServiceTest(TestCase): def setUp(self): lifestyle = vest_service.add_section("LIFESTYLE") equilibrium = vest_service.add_section("EQUILIBRIUM") suppo...
{ "repo_name": "ushatil/wellness-tracker", "path": "ws/wellspring/tests/test_vest_service.py", "copies": "1", "size": "5247", "license": "mit", "hash": -239623308527035070, "line_mean": 54.829787234, "line_max": 120, "alpha_frac": 0.6946826758, "autogenerated": false, "ratio": 3.653899721448468, ...
from django.test import TestCase from widgeter.registry import registry from widgeter.core import Widget from django.template import Template, Context, TemplateSyntaxError class RegistryTest(TestCase): def setUp(self): registry.widgets = {} def test_register_valid(self): widget = 'widget' ...
{ "repo_name": "cfpb/django-widgeter", "path": "widgeter/tests.py", "copies": "1", "size": "2400", "license": "cc0-1.0", "hash": -2811847995126716000, "line_mean": 26.2727272727, "line_max": 66, "alpha_frac": 0.5725, "autogenerated": false, "ratio": 4.387568555758683, "config_test": true, "has...
from django.test import TestCase from xfeeds.models import Feed from xfeeds.models import FeedCategory from xfeeds.models import FeedItem from xfeeds.models import FeedItemCategory from xfeeds.models import CachedImage from xfeeds.parser import tasks import os from glob import glob # Create your tests here. class TestF...
{ "repo_name": "rubeon/django-xfeeds", "path": "xfeeds/tests/test_feeds.py", "copies": "1", "size": "2395", "license": "bsd-2-clause", "hash": -4328827371553603600, "line_mean": 37.0317460317, "line_max": 119, "alpha_frac": 0.6334029228, "autogenerated": false, "ratio": 3.3779971791255288, "conf...
from django.test import TestCase import datetime from django.utils import timezone from .models import Question from django.core.urlresolvers import reverse # Create your tests here. class QuestionMethodTests(TestCase): def test_was_published_recently_with_future_question(self): time = timezone.now() + dat...
{ "repo_name": "LoopSun/PythonWay", "path": "GetYourStar/DjangoProj/packets/polls/tests.py", "copies": "2", "size": "2879", "license": "bsd-2-clause", "hash": -7727466263122714000, "line_mean": 45.4516129032, "line_max": 141, "alpha_frac": 0.706147968, "autogenerated": false, "ratio": 3.8958051420...
from django.test import TestCase import datetime from django.utils import timezone from polls.models import Poll from django.core.urlresolvers import reverse # Create your tests here. def create_poll(question,days): """ Creates a poll with the given `question` published the given number of `days` offset...
{ "repo_name": "lu18887/perhapsgeekblog", "path": "perhapsgeek/polls/tests.py", "copies": "1", "size": "4593", "license": "mit", "hash": 8925336294745154000, "line_mean": 37.2833333333, "line_max": 103, "alpha_frac": 0.6366209449, "autogenerated": false, "ratio": 3.969749351771824, "config_test"...
from django.test import TestCase import datetime from global_map.models import Clan, Front, Province import mock import pytz class TestUpdateProvince(TestCase): def setUp(self): self.front = Front.objects.create(front_id='front_id', max_vehicle_level=99) self.province = Province.objects.create( ...
{ "repo_name": "monester/wot-battles", "path": "global_map/tests/test_province_assault.py", "copies": "1", "size": "1798", "license": "mit", "hash": 5467704003597008000, "line_mean": 46.3157894737, "line_max": 94, "alpha_frac": 0.6284760845, "autogenerated": false, "ratio": 3.281021897810219, "c...
from django.test import TestCase import datetime from wellspring.services import device_service, vest_service, report_service from django.core.exceptions import ObjectDoesNotExist, ValidationError from wellspring.exceptions import DeviceNotRegistered sarah_uuid = "Android@SarahHTCXXX464" john_uuid = "IOS@JohnIPhoneXXX...
{ "repo_name": "ushatil/wellness-tracker", "path": "ws/wellspring/tests/test_report_service.py", "copies": "1", "size": "8227", "license": "mit", "hash": 7557751031171627000, "line_mean": 52.7777777778, "line_max": 159, "alpha_frac": 0.3884769661, "autogenerated": false, "ratio": 5.031804281345566...
from django.test import TestCase import django_databrowse from . import SomeModel, SomeOtherModel, YetAnotherModel from django.test import Client from django_databrowse.datastructures import EasyModel class DatabrowseTests(TestCase): @classmethod def tearDownClass(self): django_databrowse.site.unregi...
{ "repo_name": "Alir3z4/django-databrowse", "path": "django_databrowse/tests/test_sites.py", "copies": "1", "size": "2885", "license": "bsd-3-clause", "hash": -7723403978480239000, "line_mean": 37.9864864865, "line_max": 76, "alpha_frac": 0.6953206239, "autogenerated": false, "ratio": 4.2055393586...
from django.test import TestCase import django.utils.version from model_mommy import mommy from exampleproject.articles.models import Article, Tag from shared_schema_tenants.helpers.tenants import create_tenant, set_current_tenant, clear_current_tenant from shared_schema_tenants.exceptions import TenantNotFoundError ...
{ "repo_name": "hugobessa/django-shared-schema-tenants", "path": "shared_schema_tenants/tests/test_managers.py", "copies": "1", "size": "5026", "license": "mit", "hash": -4035781849283870700, "line_mean": 43.0877192982, "line_max": 114, "alpha_frac": 0.6553919618, "autogenerated": false, "ratio": ...
from django.test import TestCase import json api_url = "http://127.0.0.1:8000/api" admin_username = 'admin' admin_password = 'admin' test1_username = 'test1' test1_password = 'test1' class APITestCase(TestCase): """ Subclass of Django's TestCase that includes login() """ def login(self, username, pas...
{ "repo_name": "emccode/HeliosBurn", "path": "heliosburn/django/hbproject/api/tests.py", "copies": "1", "size": "33235", "license": "mit", "hash": -2342687670941259300, "line_mean": 36.7241770715, "line_max": 116, "alpha_frac": 0.4455543854, "autogenerated": false, "ratio": 4.587301587301587, "c...
from django.test import TestCase import json from django_comments_xtd.models import XtdComment from wagtail.wagtailcore.models import Page from django.contrib.auth.models import User from .models import (BlogPage, BlogTag, BlogPageTag, BlogIndexPage, BlogCategory, BlogCategoryBlogPage) from .manage...
{ "repo_name": "honewatson/wagtail_blog", "path": "blog/tests.py", "copies": "2", "size": "2797", "license": "apache-2.0", "hash": 1663742051825811500, "line_mean": 47.224137931, "line_max": 78, "alpha_frac": 0.6700035753, "autogenerated": false, "ratio": 3.9957142857142856, "config_test": true,...
from django.test import TestCase import json from mpr import models, apiv1 def test_serialiser(products): return [p.pk for p in products] def test_serialise_product(product): return { "id" : product.id, "name" : product.name } class TestApi(TestCase): fixtures = ["mpr_models.json"] ...
{ "repo_name": "Code4SA/medicine-price-registry", "path": "mpr/tests/test_apiv1.py", "copies": "1", "size": "2835", "license": "apache-2.0", "hash": 9053974183395581000, "line_mean": 29.8152173913, "line_max": 78, "alpha_frac": 0.6423280423, "autogenerated": false, "ratio": 3.7155963302752295, "...
from django.test import TestCase import json from nose.tools import assert_equal from stagecraft.apps.datasets.models import DataGroup from stagecraft.apps.datasets.tests.factories import DataGroupFactory class DataGroupsViewsTestCase(TestCase): def test_post(self): data_group = { 'name': 'ca...
{ "repo_name": "alphagov/stagecraft", "path": "stagecraft/apps/datasets/tests/views/test_data_group.py", "copies": "1", "size": "2647", "license": "mit", "hash": 7667335244076134000, "line_mean": 32.0875, "line_max": 73, "alpha_frac": 0.6108802418, "autogenerated": false, "ratio": 3.85298398835516...
from django.test import TestCase import json import base64 class APIBuildTests(TestCase): fixtures = ['eric.json', 'test_data.json'] def test_make_build(self): """ Test that a superuser can use the API """ post_data = {"project": "/api/v1/project/1/", "vers...
{ "repo_name": "ojii/readthedocs.org", "path": "readthedocs/rtd_tests/tests/test_api.py", "copies": "1", "size": "5281", "license": "mit", "hash": -5855448051951390000, "line_mean": 40.9126984127, "line_max": 99, "alpha_frac": 0.4902480591, "autogenerated": false, "ratio": 4.245176848874598, "co...
from django.test import TestCase import json import logging from projects.models import Project from projects import tasks log = logging.getLogger(__name__) class PostCommitTest(TestCase): fixtures = ["eric", "test_data"] def tearDown(self): tasks.update_docs = self.old_bd def setUp(self): ...
{ "repo_name": "phalcon/readthedocs.org", "path": "readthedocs/rtd_tests/tests/test_post_commit_hooks.py", "copies": "1", "size": "4432", "license": "mit", "hash": -6557341434843736000, "line_mean": 37.2068965517, "line_max": 79, "alpha_frac": 0.5135379061, "autogenerated": false, "ratio": 3.87751...
from django.test import TestCase import json import logging from readthedocs.projects.models import Project from readthedocs.projects import tasks log = logging.getLogger(__name__) class GitLabWebHookTest(TestCase): fixtures = ["eric", "test_data"] def tearDown(self): tasks.update_docs = self.old_b...
{ "repo_name": "stevepiercy/readthedocs.org", "path": "readthedocs/rtd_tests/tests/test_post_commit_hooks.py", "copies": "1", "size": "9040", "license": "mit", "hash": 210168417171495520, "line_mean": 40.8518518519, "line_max": 109, "alpha_frac": 0.5388274336, "autogenerated": false, "ratio": 3.67...