text
stringlengths
0
1.05M
meta
dict
from django.test import TestCase from mock import patch from templated_email import get_templated_mail class GetTemplatedMailTestCase(TestCase): TEST_ARGS = ['a_template_name', {'context': 'content'}] TEST_KWARGS = { 'from_email': 'from@example.com', 'to': ['to@example.com'], 'cc': [...
{ "repo_name": "vintasoftware/django-templated-email", "path": "tests/test_get_templated_mail.py", "copies": "2", "size": "2466", "license": "mit", "hash": -1729526627829810200, "line_mean": 37.53125, "line_max": 83, "alpha_frac": 0.6370640714, "autogenerated": false, "ratio": 3.7194570135746607, ...
from django.test import TestCase from ...model_generator import get_alphabetic_user_profiles from ddcz.tavern import create_tavern_table class TestPublicTableAccess(TestCase): def setUp(self): super().setUp() self.profiles = get_alphabetic_user_profiles(number_of_users=3, saved=True) se...
{ "repo_name": "dracidoupe/graveyard", "path": "ddcz/tests/test_integration/test_tavern/test_access.py", "copies": "1", "size": "1171", "license": "mit", "hash": 2574265694377873400, "line_mean": 29.0256410256, "line_max": 83, "alpha_frac": 0.6404782237, "autogenerated": false, "ratio": 3.60307692...
from django.test import TestCase from model_mommy import mommy from documents.models import Document from documents.tasks.wiki_processor import delete_removed_files from interface.path_processor import PathProcessor class DeleteRemovedFileTest(TestCase): def setUp(self): self.repo = mommy.make_recipe(...
{ "repo_name": "ZeroCater/Eyrie", "path": "documents/tests/test_wiki_processor.py", "copies": "1", "size": "1978", "license": "mit", "hash": 4002109381536594000, "line_mean": 31.9666666667, "line_max": 95, "alpha_frac": 0.6820020222, "autogenerated": false, "ratio": 3.8038461538461537, "config_t...
from django.test import TestCase from model_mommy import mommy from .models import RegistrationNumber, Distribution class DistributionTests(TestCase): def setUp(self): cards = [] for number in xrange(1, 16): cards.append(mommy.prepare(RegistrationNumber, number=number, ...
{ "repo_name": "ukch/refugeedata", "path": "refugeedata/tests.py", "copies": "1", "size": "1375", "license": "mit", "hash": 776888086329391200, "line_mean": 39.4411764706, "line_max": 81, "alpha_frac": 0.6407272727, "autogenerated": false, "ratio": 3.5807291666666665, "config_test": true, "has...
from django.test import TestCase from model_mommy import mommy import mox from djblog.views import IndexView, ArticleView, CategoryView from djblog.models import Article class IndexViewTest(TestCase): def setUp(self): self.view = IndexView() def test_attrs(self): self.assertEqual(self.view...
{ "repo_name": "buddylindsey/dj-blog", "path": "tests/test_views.py", "copies": "1", "size": "1777", "license": "bsd-3-clause", "hash": -3395278687031678000, "line_mean": 28.131147541, "line_max": 68, "alpha_frac": 0.6674169949, "autogenerated": false, "ratio": 3.6943866943866945, "config_test":...
from django.test import TestCase from model_mommy.recipe import Recipe from legalaid.admin_support.forms import CategoryModelForm from legalaid.models import Category category_recipe = Recipe(Category) class CategoryModelFormTestCase(TestCase): def test_save(self): category = category_recipe.make() ...
{ "repo_name": "ministryofjustice/cla_backend", "path": "cla_backend/apps/legalaid/tests/test_admin_forms.py", "copies": "1", "size": "1159", "license": "mit", "hash": 820662468773854800, "line_mean": 37.6333333333, "line_max": 117, "alpha_frac": 0.6686798965, "autogenerated": false, "ratio": 3.83...
from django.test import TestCase from .models.default_related_name import Author, Book, Editor class DefaultRelatedNameTests(TestCase): @classmethod def setUpTestData(cls): cls.author = Author.objects.create(first_name='Dave', last_name='Loper') cls.editor = Editor.objects.create(name='Test ...
{ "repo_name": "dgladkov/django", "path": "tests/model_options/test_default_related_name.py", "copies": "1", "size": "1169", "license": "bsd-3-clause", "hash": -7421665331292077000, "line_mean": 39.3103448276, "line_max": 95, "alpha_frac": 0.7014542344, "autogenerated": false, "ratio": 3.664576802...
from django.test import TestCase from .models.default_related_name import Author, Book, Editor class DefaultRelatedNameTests(TestCase): def setUp(self): self.author = Author.objects.create(first_name="Dave", last_name="Loper") self.editor = Editor.objects.create(name="Test Editions", ...
{ "repo_name": "Batterfii/django", "path": "tests/model_options/test_default_related_name.py", "copies": "308", "size": "1645", "license": "bsd-3-clause", "hash": 3457672155390063000, "line_mean": 34.7608695652, "line_max": 81, "alpha_frac": 0.6310030395, "autogenerated": false, "ratio": 4.4101876...
from django.test import TestCase from models import Album, Image class AlbumModelTests(TestCase): def setUp(self): a, created = Album.objects.get_or_create(title="lion", public=True) # a.save() b, created = Album.objects.get_or_create(title="cat", public=True) # b.save() ...
{ "repo_name": "vollov/egallery", "path": "gallery/picture/tests.py", "copies": "1", "size": "1394", "license": "mit", "hash": 8918976447376692000, "line_mean": 32.2142857143, "line_max": 141, "alpha_frac": 0.5961262554, "autogenerated": false, "ratio": 3.3509615384615383, "config_test": true, ...
from django.test import TestCase from .models import Article, Car, Driver, Reporter class ManyToOneNullTests(TestCase): @classmethod def setUpTestData(cls): # Create a Reporter. cls.r = Reporter(name='John Smith') cls.r.save() # Create an Article. cls.a = Article(headl...
{ "repo_name": "theo-l/django", "path": "tests/many_to_one_null/tests.py", "copies": "6", "size": "6386", "license": "bsd-3-clause", "hash": -2012856516596504800, "line_mean": 43.9718309859, "line_max": 109, "alpha_frac": 0.6301284059, "autogenerated": false, "ratio": 3.858610271903323, "config_...
from django.test import TestCase from .models import Article, Car, Driver, Reporter class ManyToOneNullTests(TestCase): def setUp(self): # Create a Reporter. self.r = Reporter(name='John Smith') self.r.save() # Create an Article. self.a = Article(headline="First", reporter...
{ "repo_name": "ghedsouza/django", "path": "tests/many_to_one_null/tests.py", "copies": "59", "size": "6156", "license": "bsd-3-clause", "hash": -1257321121331462100, "line_mean": 44.2647058824, "line_max": 109, "alpha_frac": 0.6310916179, "autogenerated": false, "ratio": 3.8741346758967903, "co...
from django.test import TestCase from models import Author, Publisher class GetOrCreateTests(TestCase): def test_related(self): p = Publisher.objects.create(name="Acme Publishing") # Create a book through the publisher. book, created = p.books.get_or_create(name="The Book of Ed & Fred") ...
{ "repo_name": "faun/django_test", "path": "tests/regressiontests/get_or_create_regress/tests.py", "copies": "4", "size": "2039", "license": "bsd-3-clause", "hash": -7874613757855064000, "line_mean": 37.4716981132, "line_max": 82, "alpha_frac": 0.6405100539, "autogenerated": false, "ratio": 3.9211...
from django.test import TestCase from .models import Category, Link class CategoryModelTests(TestCase): def test_category_sort(self): Category.objects.create(title='Test 2', slug='test2') Category.objects.create(title='Test 1', slug='test1') self.assertEqual( ['Test 1', 'Tes...
{ "repo_name": "michaelmior/pylinks", "path": "pylinks/links/tests.py", "copies": "1", "size": "2658", "license": "mit", "hash": -545546137780096400, "line_mean": 32.6455696203, "line_max": 79, "alpha_frac": 0.5827689992, "autogenerated": false, "ratio": 3.7917261055634808, "config_test": true, ...
from django.test import TestCase from models import Child1, Child2, Child3, Child4, Child5, Child6, Child7 class ManagersRegressionTests(TestCase): def test_managers(self): a1 = Child1.objects.create(name='fred', data='a1') a2 = Child1.objects.create(name='barney', data='a2') b1 = Child2....
{ "repo_name": "350dotorg/Django", "path": "tests/regressiontests/managers_regress/tests.py", "copies": "92", "size": "2544", "license": "bsd-3-clause", "hash": 3237712535874277000, "line_mean": 46.1111111111, "line_max": 83, "alpha_frac": 0.5955188679, "autogenerated": false, "ratio": 3.523545706...
from django.test import TestCase from .models import Claimant, fix_url class FixURLTest(TestCase): def test_none(self): url = None expected_url = None self.assertEqual(fix_url(url), expected_url) def test_blank(self): url = "" expected_url = "" self.assertEqu...
{ "repo_name": "softwaresaved/fat", "path": "lowfat/tests_models.py", "copies": "2", "size": "1345", "license": "bsd-3-clause", "hash": -673608795421998800, "line_mean": 24.3773584906, "line_max": 59, "alpha_frac": 0.5836431227, "autogenerated": false, "ratio": 3.6748633879781423, "config_test":...
from django.test import TestCase from .models import Color class LightsTest(TestCase): def test_no_color(self): self.assertRaises(Color.DoesNotExist, Color.objects.get) resp = self.client.get("/lights/LEDP.txt") self.assertEqual(resp["content-type"], "text/plain") self.assertEqual...
{ "repo_name": "thepoly/Pipeline", "path": "lights/tests.py", "copies": "1", "size": "1113", "license": "mit", "hash": -64002550356481370, "line_mean": 36.1, "line_max": 81, "alpha_frac": 0.6334231806, "autogenerated": false, "ratio": 3.414110429447853, "config_test": true, "has_no_keywords": ...
from django.test import TestCase from models import Counter, WithCustomPK from django.db import DatabaseError, IntegrityError class ForceInsertUpdateTestCase(TestCase): def test_normal_case(self): c = Counter.objects.create(name="one", value=1) # The normal case c.value = 2 c.save...
{ "repo_name": "sam-tsai/django-old", "path": "tests/modeltests/force_insert_update/tests.py", "copies": "1", "size": "1725", "license": "bsd-3-clause", "hash": -3089162579984485000, "line_mean": 34.2040816327, "line_max": 70, "alpha_frac": 0.5785507246, "autogenerated": false, "ratio": 4.25925925...
from django.test import TestCase from .models import ( CompetingTeam, Event, Group, IndividualCompetitor, Membership, Person, ) class MultiTableTests(TestCase): @classmethod def setUpTestData(cls): cls.alice = Person.objects.create(name='Alice') cls.bob = Person.objects.create(name='Bob')...
{ "repo_name": "EmadMokhtar/Django", "path": "tests/m2m_through_regress/test_multitable.py", "copies": "106", "size": "2178", "license": "mit", "hash": -2908809851246786600, "line_mean": 43.4489795918, "line_max": 111, "alpha_frac": 0.6799816345, "autogenerated": false, "ratio": 3.5822368421052633...
from django.test import TestCase from .models import ( Event, Movie, Package, PackageNullFK, Person, Screening, ScreeningNullFK, ) # These are tests for #16715. The basic scheme is always the same: 3 models with # 2 relations. The first relation may be null, while the second is non-nullable. # In some cases, Dja...
{ "repo_name": "wkschwartz/django", "path": "tests/nested_foreign_keys/tests.py", "copies": "62", "size": "9495", "license": "bsd-3-clause", "hash": 7633375148669193000, "line_mean": 52.9488636364, "line_max": 119, "alpha_frac": 0.6984728805, "autogenerated": false, "ratio": 3.7873952931790984, ...
from django.test import TestCase from ..models import ( Ticket, TicketZendeskAPIUsage ) from agents.models import Agent from agent_groups.models import AgentGroup from boards.models import Board class TicketTest(TestCase): def test_save_ticket(self): agent = Agent.objects.create(name='Kan', zende...
{ "repo_name": "prontotools/zendesk-tickets-machine", "path": "zendesk_tickets_machine/tickets/tests/test_models.py", "copies": "1", "size": "5703", "license": "mit", "hash": 5354575702498090000, "line_mean": 34.2037037037, "line_max": 76, "alpha_frac": 0.6077503069, "autogenerated": false, "ratio...
from django.test import TestCase from .models import Organiser, Pool, PoolStyle, Tournament class ExistingRelatedInstancesTests(TestCase): @classmethod def setUpTestData(cls): cls.t1 = Tournament.objects.create(name='Tourney 1') cls.t2 = Tournament.objects.create(name='Tourney 2') cl...
{ "repo_name": "theo-l/django", "path": "tests/known_related_objects/tests.py", "copies": "106", "size": "6375", "license": "bsd-3-clause", "hash": 3323280239794879500, "line_mean": 45.1956521739, "line_max": 94, "alpha_frac": 0.6382745098, "autogenerated": false, "ratio": 3.5162713734142304, "c...
from django.test import TestCase from models import Person, Book, Car, PersonManager, PublishedBookManager class CustomManagerTests(TestCase): def test_manager(self): p1 = Person.objects.create(first_name="Bugs", last_name="Bunny", fun=True) p2 = Person.objects.create(first_name="Droopy", last_na...
{ "repo_name": "mitsuhiko/django", "path": "tests/modeltests/custom_managers/tests.py", "copies": "92", "size": "2283", "license": "bsd-3-clause", "hash": -7473895136339600000, "line_mean": 31.1549295775, "line_max": 83, "alpha_frac": 0.5619798511, "autogenerated": false, "ratio": 4.15846994535519...
from django.test import TestCase from ..models import Punchline from .factories import ( AlbumFactory, ArtistFactory, PunchlineFactory, SongFactory, ) class RelationshipTestCase(TestCase): def test_delete_album(self): album = AlbumFactory() song = SongFactory(album=album) album.delet...
{ "repo_name": "ychab/punchline", "path": "punchline/music/tests/test_models.py", "copies": "1", "size": "1048", "license": "mit", "hash": -1487269596524412200, "line_mean": 26.5789473684, "line_max": 63, "alpha_frac": 0.6440839695, "autogenerated": false, "ratio": 3.838827838827839, "config_tes...
from django.test import TestCase from ..models import Redirect class BaseRedirectTestCase(TestCase): def setUp(self): # A regular expression redirect. self.regex_redirect = Redirect.objects.create( old_path=r"/regex-tset-cases/(.*)/", new_path=r"/regex-test-cases/\1/", ...
{ "repo_name": "onespacemedia/cms-redirects", "path": "redirects/tests/base.py", "copies": "1", "size": "1155", "license": "mit", "hash": 692508818812948700, "line_mean": 32, "line_max": 59, "alpha_frac": 0.5896103896, "autogenerated": false, "ratio": 4.066901408450704, "config_test": true, "h...
from django.test import TestCase from .models import Schedule, OneSchedule from . import solid_data as sd class ScheduleTests(TestCase): """ Test for method of Schedule model. """ def test_get_month_calendar(self): """Test for method get_month_calendar for Schedule object. Should retu...
{ "repo_name": "piemar1/Schedule_django", "path": "schedule/tests_model.py", "copies": "1", "size": "10892", "license": "mit", "hash": 7561771221741335000, "line_mean": 45.7253218884, "line_max": 79, "alpha_frac": 0.5939193534, "autogenerated": false, "ratio": 3.4257394587791064, "config_test": ...
from django.test import TestCase from .models import Service class ServiceModelTest(TestCase): def test_service_representation(self): service = Service(service_name='TEST SERVICE') service_repr = '%s - %s' % (service.service_name, service.token) self.assertEqual(service_repr, str(service...
{ "repo_name": "topix-hackademy/contact-tools", "path": "contacts/tests.py", "copies": "1", "size": "1084", "license": "mit", "hash": -4178066371528822000, "line_mean": 35.1333333333, "line_max": 76, "alpha_frac": 0.6854243542, "autogenerated": false, "ratio": 4.075187969924812, "config_test": t...
from django.test import TestCase from .models import ShowType class ShowTypeModelTests(TestCase): def setUp(self): self.test_show_type = ShowType() self.test_show_type.name = 'Test Show' self.test_show_type.save() def test_name_hex_color_get(self): self.assertEqual(self.test_...
{ "repo_name": "stevehead/youtubefeed", "path": "feed/tests.py", "copies": "1", "size": "1380", "license": "mit", "hash": -8617937126946086000, "line_mean": 32.6829268293, "line_max": 102, "alpha_frac": 0.6239130435, "autogenerated": false, "ratio": 3.565891472868217, "config_test": true, "has...
from django.test import TestCase from .models import SlugPage class RestrictedConditionsTests(TestCase): def setUp(self): slugs = [ 'a', 'a/a', 'a/b', 'a/b/a', 'x', 'x/y/z', ] SlugPage.objects.bulk_create([SlugPage(sl...
{ "repo_name": "frishberg/django", "path": "tests/foreign_object/test_empty_join.py", "copies": "22", "size": "1488", "license": "bsd-3-clause", "hash": 7224856924762159000, "line_mean": 30.6595744681, "line_max": 77, "alpha_frac": 0.5288978495, "autogenerated": false, "ratio": 3.492957746478873, ...
from django.test import TestCase from .models import Translation from .helpers import _ def create_translation(): return (Translation.objects.create(language='fr', source="Test me!", trans="Testez-moi !"), Translation.objec...
{ "repo_name": "vinyll/django-transadmin", "path": "transadmin/tests.py", "copies": "1", "size": "1842", "license": "bsd-3-clause", "hash": -8779545231244588000, "line_mean": 33.1111111111, "line_max": 76, "alpha_frac": 0.503257329, "autogenerated": false, "ratio": 4.698979591836735, "config_tes...
from django.test import TestCase from .models import User, CollectionSet, Credential, Collection, Seed, Group, Harvest, HarvestStat, Warc, \ default_uuid, Export from .utils import collection_path as get_collection_path, collection_set_path as get_collection_set_path import pytz from datetime import datetime, dat...
{ "repo_name": "gwu-libraries/sfm-ui", "path": "sfm/ui/test_models.py", "copies": "2", "size": "22374", "license": "mit", "hash": -5286563857888145000, "line_mean": 53.7041564792, "line_max": 114, "alpha_frac": 0.5746402074, "autogenerated": false, "ratio": 4.57265481299816, "config_test": true,...
from django.test import TestCase from models import (User, UserProfile, UserStat, UserStatResult, StatDetails, AdvancedUserStat, Image, Product) class ReverseSelectRelatedTestCase(TestCase): def setUp(self): user = User.objects.create(username="test") userprofile = UserProfile.objects.create(u...
{ "repo_name": "disqus/django-old", "path": "tests/regressiontests/select_related_onetoone/tests.py", "copies": "1", "size": "3989", "license": "bsd-3-clause", "hash": -6271169184799854000, "line_mean": 44.3295454545, "line_max": 110, "alpha_frac": 0.6322386563, "autogenerated": false, "ratio": 4....
from django.test import TestCase from .models import Wine, Winery class TestWineFiltering(TestCase): def setUp(self): self.winery = Winery.objects.create( name="Test Winery", country="United States", region="DC") def test_in_cellar_filter_true(self): undra...
{ "repo_name": "ctbarna/cellar", "path": "app/wine/tests.py", "copies": "1", "size": "1730", "license": "mit", "hash": 281059679470093000, "line_mean": 29.350877193, "line_max": 45, "alpha_frac": 0.5283236994, "autogenerated": false, "ratio": 3.7124463519313307, "config_test": true, "has_no_ke...
from django.test import TestCase from .models import YaraRule from .REST_filters import YaraRuleFilter from .testing_core import generate_test_user class YaraRuleFilterTestCase(TestCase): """ Test custom filter methods within YaraRuleFilter """ # Reserved keyword value that should never match failure_ke...
{ "repo_name": "PUNCH-Cyber/YaraGuardian", "path": "rules/test_REST_filters.py", "copies": "1", "size": "15222", "license": "apache-2.0", "hash": -646127252350753400, "line_mean": 48.1032258065, "line_max": 112, "alpha_frac": 0.6373669689, "autogenerated": false, "ratio": 4.12520325203252, "conf...
from django.test import TestCase from model_urls.helpers import simple_url, model_url, url from model_urls.urlresolvers import reverse, dj_reverse, model_reverse from model_urls.tests.models import DummyModel urlconf = 'model_urls.tests.urls' dummy = DummyModel("my-name", ref=DummyModel("my-ref...
{ "repo_name": "vinyll/django-model-urls", "path": "model_urls/tests/jingo.py", "copies": "1", "size": "1753", "license": "mit", "hash": 8262777754233302000, "line_mean": 32.0754716981, "line_max": 77, "alpha_frac": 0.5955504849, "autogenerated": false, "ratio": 4.011441647597254, "config_test":...
from django.test import TestCase from model_utils import Choices class ChoicesTests(TestCase): def setUp(self): self.STATUS = Choices('DRAFT', 'PUBLISHED') def test_getattr(self): self.assertEqual(self.STATUS.DRAFT, 'DRAFT') def test_indexing(self): self.assertEqual(self.STATUS[...
{ "repo_name": "carljm/django-model-utils", "path": "tests/test_choices.py", "copies": "1", "size": "9090", "license": "bsd-3-clause", "hash": 1992856949098267100, "line_mean": 28.7058823529, "line_max": 96, "alpha_frac": 0.5207920792, "autogenerated": false, "ratio": 3.9487402258905298, "config...
from django.test import TestCase from molo.core.models import ArticlePage, Languages, SiteLanguageRelation from molo.core.tests.base import MoloTestCaseMixin class TestHookDeletePageTranslations(TestCase, MoloTestCaseMixin): def setUp(self): self.mk_main() language_setting = Languages.for_site(s...
{ "repo_name": "praekelt/molo", "path": "molo/core/tests/wagtail_hooks/test_delete_page_translations.py", "copies": "1", "size": "2586", "license": "bsd-2-clause", "hash": 6094533319054609000, "line_mean": 39.40625, "line_max": 75, "alpha_frac": 0.6477184841, "autogenerated": false, "ratio": 3.747...
from django.test import TestCase from mozdns.address_record.models import AddressRecord from mozdns.cname.models import CNAME from mozdns.txt.models import TXT from mozdns.mx.models import MX from mozdns.srv.models import SRV from mozdns.domain.models import Domain from mozdns.nameserver.models import Nameserver from ...
{ "repo_name": "rtucker-mozilla/inventory", "path": "mozdns/domain/tests/auto_update.py", "copies": "3", "size": "2200", "license": "bsd-3-clause", "hash": 4729381189648298000, "line_mean": 32.3333333333, "line_max": 72, "alpha_frac": 0.6413636364, "autogenerated": false, "ratio": 3.45368916797488...
from django.test import TestCase from mozdns.sshfp.models import SSHFP from mozdns.domain.models import Domain class SSHFPTests(TestCase): def setUp(self): self.o = Domain(name="org") self.o.save() self.o_e = Domain(name="mozilla.org") self.o_e.save() def do_generic_add(self,...
{ "repo_name": "rtucker-mozilla/mozilla_inventory", "path": "mozdns/sshfp/tests.py", "copies": "3", "size": "2066", "license": "bsd-3-clause", "hash": -7580476540408316000, "line_mean": 31.7936507937, "line_max": 71, "alpha_frac": 0.5701839303, "autogenerated": false, "ratio": 3.159021406727829, ...
from django.test import TestCase from mozdns.tests.utils import create_fake_zone from mozdns.ptr.models import PTR from mozdns.cname.models import CNAME from mozdns.address_record.models import AddressRecord from core.search.compiler.django_compile import compile_to_django class IntegrationTests(TestCase): """A ...
{ "repo_name": "mozilla/inventory", "path": "mozdns/tests/integration.py", "copies": "3", "size": "6864", "license": "bsd-3-clause", "hash": -2562280254755159000, "line_mean": 38.676300578, "line_max": 78, "alpha_frac": 0.5718240093, "autogenerated": false, "ratio": 3.386285150468673, "config_te...
from django.test import TestCase from mozdns.txt.models import TXT from mozdns.domain.models import Domain class TXTTests(TestCase): def setUp(self): self.o = Domain(name="org") self.o.save() self.o_e = Domain(name="oregonstate.org") self.o_e.save() def do_generic_add(self, d...
{ "repo_name": "rtucker-mozilla/mozilla_inventory", "path": "mozdns/txt/tests.py", "copies": "1", "size": "1480", "license": "bsd-3-clause", "hash": 5666498809316645000, "line_mean": 28.0196078431, "line_max": 69, "alpha_frac": 0.5527027027, "autogenerated": false, "ratio": 3.2671081677704192, "...
from django.test import TestCase from mtr.sync.tests import SyncTestMixin from mtr.sync.lib import Processor from mtr.sync.lib.processors.xls import XlsProcessor from ...models import Person, Office, Tag class TestProcessor(Processor): pass class SecondProcessor(Processor): position = 1 class ThirdProce...
{ "repo_name": "mtrgroup/django-mtr-sync", "path": "tests/app/tests/lib/manager.py", "copies": "1", "size": "1431", "license": "mit", "hash": 8159598928757453000, "line_mean": 27.0588235294, "line_max": 68, "alpha_frac": 0.6568832984, "autogenerated": false, "ratio": 3.953038674033149, "config_t...
from django.test import TestCase from nose.tools import eq_ from amon.apps.plugins.helpers import ( flat_to_tree_dict_helper, replace_underscore_with_dot_helper ) class TestPluginHelpers(TestCase): def flat_to_tree_dict_helper_test(self): data = {'t': 1, 'count.test': 2, 'second.test': 4, 'more...
{ "repo_name": "martinrusev/amonone", "path": "amon/apps/plugins/tests/helpers_test.py", "copies": "1", "size": "1577", "license": "mit", "hash": -1479911932604893400, "line_mean": 33.3043478261, "line_max": 125, "alpha_frac": 0.5884590996, "autogenerated": false, "ratio": 2.947663551401869, "co...
from django.test import TestCase from nose.tools import eq_, ok_ from us_ignite.common import forms ORDER_CHOICES = [ ('name', 'Name'), ('-name', '-Name'), ] class TestOrderForm(TestCase): def test_order_form_accepts_order_choices(self): form = forms.OrderForm(order_choices=ORDER_CHOICES) ...
{ "repo_name": "us-ignite/us_ignite", "path": "us_ignite/common/tests/forms_tests.py", "copies": "1", "size": "1188", "license": "bsd-3-clause", "hash": -4841848583037325000, "line_mean": 29.4615384615, "line_max": 68, "alpha_frac": 0.6296296296, "autogenerated": false, "ratio": 3.4941176470588236...
from django.test import TestCase from oauth2_provider.models import AccessToken from geokey.applications.tests.model_factories import ApplicationFactory from geokey.projects.tests.model_factories import ProjectF from geokey.categories.tests.model_factories import CategoryFactory from .model_factories import UserGroup...
{ "repo_name": "nagyistoce/geokey", "path": "geokey/users/tests/test_models.py", "copies": "1", "size": "3170", "license": "apache-2.0", "hash": 4756062875936562000, "line_mean": 29.7766990291, "line_max": 74, "alpha_frac": 0.6135646688, "autogenerated": false, "ratio": 3.7470449172576834, "conf...
from django.test import TestCase from opbeat.middleware import Opbeat from ..helpers import get_tempstoreclient import webob def example_app(environ, start_response): raise ValueError('hello world') class MiddlewareTest(TestCase): def setUp(self): self.app = example_app def test_error_handler(...
{ "repo_name": "ticosax/opbeat_python", "path": "tests/middleware/tests.py", "copies": "4", "size": "1736", "license": "bsd-3-clause", "hash": -4722409196309619000, "line_mean": 34.4285714286, "line_max": 70, "alpha_frac": 0.6353686636, "autogenerated": false, "ratio": 4.065573770491803, "config...
from django.test import TestCase from openrosa.serializer import XFormSerializer from openrosa.xform_reader import XFormReader from repos.models import Repository, RepoSerializer # Tutorial xform with basic data/survey types XFORM_FILE = '../_data/test_docs/tutorial.xml' MANIFEST_DATA = { 'repo': 'test_repo', ...
{ "repo_name": "DHLabs/keep", "path": "keep_backend/tests/test_openrosa/test_serializer.py", "copies": "2", "size": "2273", "license": "mit", "hash": -6143499089993081000, "line_mean": 29.7162162162, "line_max": 79, "alpha_frac": 0.6071271447, "autogenerated": false, "ratio": 4.2565543071161045, ...
from django.test import TestCase from openrosa.xform_reader import XFormReader # Tutorial xform with basic data/survey types XFORM_FILE = '../_data/test_docs/tutorial.xml' # Basic i18n xform with translated labels I18N_XFORM = '../_data/test_docs/zambia/Child Visit.xml' # Translated constrai...
{ "repo_name": "9929105/KEEP", "path": "keep_backend/tests/test_openrosa/test_xform_reader.py", "copies": "2", "size": "1274", "license": "mit", "hash": 3972436865309843500, "line_mean": 30.0731707317, "line_max": 81, "alpha_frac": 0.6138147567, "autogenerated": false, "ratio": 3.703488372093023, ...
from django.test import TestCase from oscar.apps.basket.models import Basket from oscar.apps.partner import strategy from oscar.test.factories import ( BasketFactory, BasketLineAttributeFactory, ProductFactory) class TestANewBasket(TestCase): def setUp(self): self.basket = Basket() self.bask...
{ "repo_name": "faratro/django-oscar", "path": "tests/unit/basket/model_tests.py", "copies": "22", "size": "1624", "license": "bsd-3-clause", "hash": 2695023021067113500, "line_mean": 28.5272727273, "line_max": 65, "alpha_frac": 0.6730295567, "autogenerated": false, "ratio": 3.7419354838709675, ...
from django.test import TestCase from oscar.apps.catalogue.reviews import forms from oscar.test.factories import create_product, UserFactory class TestReviewForm(TestCase): def setUp(self): self.product = create_product() self.reviewer = UserFactory() self.data = { 'title': '...
{ "repo_name": "mexeniz/django-oscar", "path": "tests/integration/catalogue/reviews/form_tests.py", "copies": "40", "size": "1806", "license": "bsd-3-clause", "hash": -8426728581223648000, "line_mean": 33.0754716981, "line_max": 76, "alpha_frac": 0.6112956811, "autogenerated": false, "ratio": 3.65...
from django.test import TestCase from oscar.apps.catalogue.reviews import forms from oscar.test.factories import UserFactory, create_product class TestReviewForm(TestCase): def test_cleans_title(self): product = create_product() reviewer = UserFactory() data = { 'title': ' T...
{ "repo_name": "sonofatailor/django-oscar", "path": "tests/integration/catalogue/reviews/test_forms.py", "copies": "10", "size": "2273", "license": "bsd-3-clause", "hash": 4095782903353007000, "line_mean": 32.4264705882, "line_max": 76, "alpha_frac": 0.5961284646, "autogenerated": false, "ratio": ...
from django.test import TestCase from oscar.apps.customer.forms import ProfileForm from oscar.core.compat import existing_user_fields, get_user_model from oscar.test.factories.customer import ProductAlertFactory, UserFactory class TestACustomUserModel(TestCase): def setUp(self): self.user_klass = get_us...
{ "repo_name": "vicky2135/lucious", "path": "tests/integration/customer/test_custom_user_model.py", "copies": "18", "size": "1204", "license": "bsd-3-clause", "hash": 3678230565693852000, "line_mean": 36.625, "line_max": 79, "alpha_frac": 0.6727574751, "autogenerated": false, "ratio": 3.6374622356...
from django.test import TestCase from oscar.apps.dashboard.ranges import forms from oscar.test.factories import create_product from oscar.apps.offer.models import Range class RangeProductFormTests(TestCase): def setUp(self): self.range = Range.objects.create(name='dummy') def tearDown(self): ...
{ "repo_name": "Bogh/django-oscar", "path": "tests/functional/dashboard/range_tests.py", "copies": "52", "size": "2098", "license": "bsd-3-clause", "hash": -3414766464413808000, "line_mean": 35.1724137931, "line_max": 63, "alpha_frac": 0.6487130601, "autogenerated": false, "ratio": 3.5559322033898...
from django.test import TestCase from oscar.apps.offer import custom, models from oscar.test import factories from tests._site.model_tests_app.models import (BasketOwnerCalledBarry, CustomBenefitModel) class TestConditionalOfferDelete(TestCase): def test_benefits...
{ "repo_name": "anandsimmy/ecommerce", "path": "tests/integration/offer/test_conditionaloffer_delete.py", "copies": "5", "size": "2255", "license": "bsd-3-clause", "hash": 3208577954138977300, "line_mean": 33.1666666667, "line_max": 76, "alpha_frac": 0.6518847007, "autogenerated": false, "ratio": ...
from django.test import TestCase from oscar.apps.offer import models from oscar.apps.catalogue import models as catalogue_models from oscar.test.factories import create_product class TestWholeSiteRange(TestCase): def setUp(self): self.range = models.Range.objects.create( name="All products",...
{ "repo_name": "jinnykoo/wuyisj.com", "path": "tests/integration/offer/range_tests.py", "copies": "7", "size": "5893", "license": "bsd-3-clause", "hash": -3561700569913007000, "line_mean": 38.8175675676, "line_max": 79, "alpha_frac": 0.6877651451, "autogenerated": false, "ratio": 3.949731903485254...
from django.test import TestCase from oscar.apps.offer import models from oscar.test.factories import ( create_order, OrderDiscountFactory, UserFactory) class TestAPerUserConditionalOffer(TestCase): def setUp(self): self.offer = models.ConditionalOffer(max_user_applications=1) self.user = Us...
{ "repo_name": "anentropic/django-oscar", "path": "tests/integration/offer/availability_tests.py", "copies": "40", "size": "1143", "license": "bsd-3-clause", "hash": -853793773920993200, "line_mean": 37.1, "line_max": 71, "alpha_frac": 0.7121609799, "autogenerated": false, "ratio": 3.6752411575562...
from django.test import TestCase from oscar.apps.partner import availability class TestBasePolicy(TestCase): def setUp(self): self.availability = availability.Base() def test_does_not_allow_any_purchases(self): result, __ = self.availability.is_purchase_permitted(1) self.assertFalse...
{ "repo_name": "jinnykoo/christmas", "path": "tests/unit/partner/availability_tests.py", "copies": "12", "size": "3140", "license": "bsd-3-clause", "hash": 5360431687098344000, "line_mean": 30.7171717172, "line_max": 77, "alpha_frac": 0.7003184713, "autogenerated": false, "ratio": 3.86223862238622...
from django.test import TestCase from oscar.apps.search import facets FACET_COUNTS = { u'dates': {}, u'fields': { 'category': [('Fiction', 12), ('Horror', 6), ('Comedy', 3)], 'product_class': [('Book', 18), ('DVD', 3)], 'rating': [], }, u'queries': { u'price_exact:[0 TO...
{ "repo_name": "jinnykoo/wuyisj", "path": "tests/unit/search/munger_tests.py", "copies": "6", "size": "2876", "license": "bsd-3-clause", "hash": 5106802394322233000, "line_mean": 31.6818181818, "line_max": 79, "alpha_frac": 0.550069541, "autogenerated": false, "ratio": 3.399527186761229, "config...
from django.test import TestCase from oscar.core.compat import get_user_model from oscar.apps.customer.models import CommunicationEventType User = get_user_model() class CommunicationTypeTest(TestCase): keys = ('body', 'html', 'sms', 'subject') def test_no_templates_returns_empty_string(self): et ...
{ "repo_name": "WillisXChen/django-oscar", "path": "tests/unit/customer/customer_tests.py", "copies": "57", "size": "1235", "license": "bsd-3-clause", "hash": -1609586400160535000, "line_mean": 34.2857142857, "line_max": 78, "alpha_frac": 0.6331983806, "autogenerated": false, "ratio": 4.1722972972...
from django.test import TestCase from package.models import Package, Version, versioner from package.tests import data class VersionTests(TestCase): def setUp(self): data.load() def test_version_order(self): p = Package.objects.get(slug='django-cms') versions = p.version_set.by_versio...
{ "repo_name": "cartwheelweb/packaginator", "path": "apps/package/tests/test_models.py", "copies": "1", "size": "1034", "license": "mit", "hash": 360723263402043900, "line_mean": 32.3548387097, "line_max": 58, "alpha_frac": 0.4477756286, "autogenerated": false, "ratio": 3.9166666666666665, "conf...
from django.test import TestCase from pages.models import ModelPage, CustomPage, FlatPage, Page from tests.models import MockEntity, MockEntityWithSync def create_instance(with_sync=True, **kwargs): cls = with_sync and MockEntityWithSync or MockEntity # noinspection PyUnresolvedReferences return cls.obje...
{ "repo_name": "fidals/refarm-site", "path": "tests/pages/test_models.py", "copies": "1", "size": "8349", "license": "mit", "hash": 2620199659076792000, "line_mean": 33.0775510204, "line_max": 88, "alpha_frac": 0.6435501258, "autogenerated": false, "ratio": 3.7456258411843875, "config_test": tru...
from django.test import TestCase from pipeline.conf import settings from pipeline.compilers import Compiler, CompilerBase class DummyCompiler(CompilerBase): output_extension = 'js' def match_file(self, path): return path.endswith('.coffee') def compile_file(self, infile, outfile, outdated=False...
{ "repo_name": "teozkr/django-pipeline", "path": "tests/tests/compiler.py", "copies": "2", "size": "1218", "license": "mit", "hash": 31781823449944784, "line_mean": 30.2307692308, "line_max": 88, "alpha_frac": 0.6765188834, "autogenerated": false, "ratio": 3.9545454545454546, "config_test": true...
from django.test import TestCase from places.forms import RestaurantForm class TestRestaurantForm(TestCase): """RestaurantForm test suite""" def test_restaurant_form_valid_with_empty(self): form_data = {"category": "", "name": ""} form = RestaurantForm(form_data) self.assertTrue(form...
{ "repo_name": "huangsam/chowist", "path": "places/tests/forms/test_restaurant.py", "copies": "1", "size": "1402", "license": "mit", "hash": -1187574498928747000, "line_mean": 28.829787234, "line_max": 57, "alpha_frac": 0.5492154066, "autogenerated": false, "ratio": 3.7688172043010755, "config_t...
from django.test import TestCase from places.models import Category, Restaurant class TestRestaurant(TestCase): """Category test suite""" @classmethod def setUpTestData(cls): r1 = Restaurant.objects.create( name="Five Guys", address="Earth", latitude=0.00, ...
{ "repo_name": "huangsam/chowist", "path": "places/tests/models/test_category.py", "copies": "1", "size": "1912", "license": "mit", "hash": 5050401462950370000, "line_mean": 31.9655172414, "line_max": 84, "alpha_frac": 0.6140167364, "autogenerated": false, "ratio": 3.5276752767527677, "config_te...
from django.test import TestCase from places.models import Restaurant, Rating class TestRating(TestCase): """Rating test suite""" ratings = [ ("This place is excellent", 5), ("This place sucks", 1), ("You should check this place out", 5), ("This place is merely okay", 3), ...
{ "repo_name": "huangsam/ciscochef", "path": "places/tests/models/test_rating.py", "copies": "1", "size": "1915", "license": "mit", "hash": -9123718828963081000, "line_mean": 31.4576271186, "line_max": 75, "alpha_frac": 0.6167101828, "autogenerated": false, "ratio": 3.6897880539499037, "config_t...
from django.test import TestCase from poradnia.letters.factories import LetterFactory from poradnia.letters.models import Letter from poradnia.records.models import Record from poradnia.users.factories import UserFactory class QuerySetTestCase(TestCase): def _test_letter_for_user(self, staff, status, res): ...
{ "repo_name": "watchdogpolska/poradnia", "path": "poradnia/records/test/test_models.py", "copies": "3", "size": "1104", "license": "mit", "hash": -3435306165218043400, "line_mean": 39.8888888889, "line_max": 87, "alpha_frac": 0.6956521739, "autogenerated": false, "ratio": 3.527156549520767, "co...
from django.test import TestCase from portal.forms import UserForm class TestUserForm(TestCase): """UserForm test suite""" def test_user_form_invalid_with_empty(self): form = UserForm() self.assertFalse(form.is_valid()) def test_user_form_invalid_with_partial(self): form_data = ...
{ "repo_name": "huangsam/chowist", "path": "portal/tests/forms/test_user.py", "copies": "1", "size": "1137", "license": "mit", "hash": 769098313582517900, "line_mean": 28.1538461538, "line_max": 68, "alpha_frac": 0.5760773967, "autogenerated": false, "ratio": 3.6095238095238096, "config_test": t...
from django.test import TestCase from portal.mailservice.mailer import Mailer from portal.mailservice.message import Message from portal.tests.test_views import create_student_and_return class MessageTests(TestCase): def setUp(self): self.student = create_student_and_return(username='ba123', name='Bob') ...
{ "repo_name": "martinzlocha/mad", "path": "portal/tests/test_mailservice.py", "copies": "1", "size": "1080", "license": "mit", "hash": 5724407842660421000, "line_mean": 29.8571428571, "line_max": 78, "alpha_frac": 0.6481481481, "autogenerated": false, "ratio": 3.884892086330935, "config_test": ...
from django.test import TestCase from postcode_api.models import Address from postcode_api.utils import AddressFormatter class AddressFormatterTestCase(TestCase): pass cases = { 'test_simple_address': { 'address': Address( building_number=16, thoroughfare_name='VIXEN ROAD',...
{ "repo_name": "ministryofjustice/postcodeinfo", "path": "postcodeinfo/apps/postcode_api/tests/test_address_formatter.py", "copies": "1", "size": "6047", "license": "mit", "hash": 7365377678537734000, "line_mean": 33.1638418079, "line_max": 87, "alpha_frac": 0.5749958657, "autogenerated": false, "...
from django.test import TestCase from powerdns.utils import to_reverse, reverse_pointer class TestReversing(TestCase): @classmethod def setUpClass(cls): super().setUpClass() cls.ipv4 = '192.168.1.2' cls.ipv6 = '2001:0db8:0:0::1428:57ab' def test_reversing_pointer_ipv4(self): ...
{ "repo_name": "dominikkowalski/django-powerdns-dnssec", "path": "powerdns/tests/test_utils.py", "copies": "2", "size": "1066", "license": "bsd-2-clause", "hash": 8161653829160062000, "line_mean": 33.3870967742, "line_max": 114, "alpha_frac": 0.6097560976, "autogenerated": false, "ratio": 2.496487...
from django.test import TestCase from projects.models import get_slug, Project, ProjectImage # Create your tests here. class ProjectTestCase(TestCase): def setUp(self): proj1 = Project.objects.create(priority=2, name='test proj 1', short_descr='Short description 1', full_de...
{ "repo_name": "brandonw/personal-site", "path": "personal-site/projects/tests.py", "copies": "1", "size": "1559", "license": "bsd-3-clause", "hash": 8625704073204721000, "line_mean": 43.5428571429, "line_max": 78, "alpha_frac": 0.6298909557, "autogenerated": false, "ratio": 3.8024390243902437, ...
from django.test import TestCase from prototype.models import Model from prototype.tests.TestUtilities import createTestModel class ModelTest(TestCase): def setUp(self): self.model = createTestModel() def tearDown(self): self.model.delete() def test_creating_a_new_model_and_saving_it_t...
{ "repo_name": "DarioGT/docker-carra", "path": "src/prototype/tests/models/test_model.py", "copies": "1", "size": "1796", "license": "mit", "hash": -7757268797336092000, "line_mean": 38.9333333333, "line_max": 84, "alpha_frac": 0.7082405345, "autogenerated": false, "ratio": 3.6356275303643724, "...
from django.test import TestCase from pt_law_downloader import get_publication, get_document from law.crawler import save_publication, save_document from law.crawler_forms import DocumentForm from law.models import Type, Document class TestCrawler(TestCase): def test_form(self): """ Notice that ...
{ "repo_name": "jorgecarleitao/public-contracts", "path": "law/test/test_crawler.py", "copies": "1", "size": "2672", "license": "bsd-3-clause", "hash": -6899297528277377000, "line_mean": 32.3, "line_max": 88, "alpha_frac": 0.5585585586, "autogenerated": false, "ratio": 3.659340659340659, "config...
from django.test import TestCase from public_interface.models import Genes from public_interface.models import Sequences from public_interface.models import GeneSets from public_interface.models import Vouchers from public_interface.models import TaxonSets from create_dataset.utils import CreateDataset class TestCre...
{ "repo_name": "carlosp420/VoSeq", "path": "voseq/create_dataset/tests/create_dataset_class/tests.py", "copies": "1", "size": "2597", "license": "bsd-3-clause", "hash": 5191597880374439000, "line_mean": 35.5774647887, "line_max": 83, "alpha_frac": 0.575664228, "autogenerated": false, "ratio": 3.64...
from django.test import TestCase from push_notifications.api.rest_framework import ( APNSDeviceSerializer, GCMDeviceSerializer, ValidationError ) GCM_DRF_INVALID_HEX_ERROR = {"device_id": [u"Device ID is not a valid hex number"]} GCM_DRF_OUT_OF_RANGE_ERROR = {"device_id": [u"Device ID is out of range"]} class APN...
{ "repo_name": "Adys/django-push-notifications", "path": "tests/test_rest_framework.py", "copies": "4", "size": "4263", "license": "mit", "hash": -6061166453838800000, "line_mean": 31.2954545455, "line_max": 89, "alpha_frac": 0.7112362186, "autogenerated": false, "ratio": 3.1624629080118694, "co...
from django.test import TestCase from pycon.tests import factories from .. import forms class TestGroupRegistrationForm(TestCase): form_class = forms.GroupRegistrationForm def setUp(self): super(TestGroupRegistrationForm, self).setUp() self.data = { 'first_name': 'Sam', ...
{ "repo_name": "njl/pycon", "path": "pycon/registration/tests/test_forms.py", "copies": "4", "size": "1646", "license": "bsd-3-clause", "hash": -327026837925654340, "line_mean": 31.2745098039, "line_max": 70, "alpha_frac": 0.6251518834, "autogenerated": false, "ratio": 3.7324263038548753, "confi...
from django.test import TestCase from pyknon.music import Note, NoteSeq from CheckMyChords.harmony_rules import Chord class NoteTests(TestCase): # not yet implemented pass class ChordTests(TestCase): # TODO: add more descriptive fail messages def setUp(self): pass def test_chord_cr...
{ "repo_name": "Ergaro/CheckMyChords", "path": "CMC/CheckMyChords/tests.py", "copies": "1", "size": "8901", "license": "mit", "hash": 944229685184205000, "line_mean": 39.4590909091, "line_max": 84, "alpha_frac": 0.5565666779, "autogenerated": false, "ratio": 2.987915407854985, "config_test": tru...
from django.test import TestCase from pymongo.errors import CollectionInvalid from .sources.base import BaseDataSource from .sources.simple import SimpleDataSource from .sources.csv_file import CSVDataSource from .sources.model import ModelDataSource from .sources.mongo import MongoDBDataSource from .renderers impor...
{ "repo_name": "agiliq/django-graphos", "path": "graphos/tests.py", "copies": "1", "size": "38867", "license": "bsd-2-clause", "hash": -4074229943983407600, "line_mean": 44.6185446009, "line_max": 548, "alpha_frac": 0.5794375691, "autogenerated": false, "ratio": 3.4914660438375855, "config_test"...
from django.test import TestCase from pyquery import PyQuery as pq from ..utils import collapse_whitespace, html_to_text class UtilsTests(TestCase): def test_collapse_whitespace(self): text = '\r\n\f\u200b \n\t ' self.assertEqual(collapse_whitespace(text), "") def test_html_to_text_one_elem...
{ "repo_name": "flupzor/bijgeschaafd", "path": "news/parsers/tests/test_utils.py", "copies": "2", "size": "1938", "license": "mit", "hash": -1158600730573228300, "line_mean": 34.8888888889, "line_max": 77, "alpha_frac": 0.5763673891, "autogenerated": false, "ratio": 3.5172413793103448, "config_t...
from django.test import TestCase from rapidsms_httprouter_src.rapidsms_httprouter.management.commands.send_messages import Command from rapidsms_httprouter_src.rapidsms_httprouter.models import MessageBatch, Message from rapidsms.models import Backend, Connection class SendMessagesCommandTestCase(TestCase): def ...
{ "repo_name": "unicefuganda/edtrac", "path": "edtrac_project/rapidsms_httprouter_src/rapidsms_httprouter/tests/test_send_messages.py", "copies": "1", "size": "2204", "license": "bsd-3-clause", "hash": 5366505531756197000, "line_mean": 38.3571428571, "line_max": 97, "alpha_frac": 0.7372958258, "auto...
from django.test import TestCase from rapidsms.tests.harness import CreateDataMixin from rtwilio.forms import TwilioForm class TwilioFormTest(CreateDataMixin, TestCase): def test_valid_form(self): """Form should be valid if GET keys match configuration.""" data = {"From": "+12223334444", ...
{ "repo_name": "caktus/rapidsms-twilio", "path": "rtwilio/tests/test_forms.py", "copies": "1", "size": "1760", "license": "bsd-3-clause", "hash": -7934468169670829000, "line_mean": 40.9047619048, "line_max": 77, "alpha_frac": 0.5931818182, "autogenerated": false, "ratio": 3.9729119638826185, "co...
from django.test import TestCase from readthedocs.api.v2.views.footer_views import get_version_compare_data from readthedocs.builds.constants import LATEST from readthedocs.projects.models import Project class VersionCompareTests(TestCase): fixtures = ['eric.json', 'test_data.json'] def setUp(self): ...
{ "repo_name": "rtfd/readthedocs.org", "path": "readthedocs/rtd_tests/tests/test_api_version_compare.py", "copies": "1", "size": "1252", "license": "mit", "hash": 7684140963607231000, "line_mean": 33.7777777778, "line_max": 74, "alpha_frac": 0.6845047923, "autogenerated": false, "ratio": 3.6823529...
from django.test import TestCase from readthedocs.builds.constants import LATEST from readthedocs.projects.models import Project from readthedocs.restapi.views.footer_views import get_version_compare_data class VersionCompareTests(TestCase): fixtures = ['eric.json', 'test_data.json'] def test_not_highest(se...
{ "repo_name": "atsuyim/readthedocs.org", "path": "readthedocs/rtd_tests/tests/test_api_version_compare.py", "copies": "34", "size": "1173", "license": "mit", "hash": -8335285169147909000, "line_mean": 34.5454545455, "line_max": 75, "alpha_frac": 0.6862745098, "autogenerated": false, "ratio": 3.70...
from django.test import TestCase from registration import forms, get_user_model TEST_USER_MODEL = get_user_model() class RegistrationFormTests(TestCase): """ Test the default registration forms. """ def test_registration_form(self): """ Test that ``RegistrationForm`` enforces usern...
{ "repo_name": "rbarrois/django-registration", "path": "registration_tests/tests/forms.py", "copies": "1", "size": "6175", "license": "bsd-3-clause", "hash": 3381676940688371700, "line_mean": 45.4285714286, "line_max": 130, "alpha_frac": 0.4382186235, "autogenerated": false, "ratio": 5.24638912489...
from django.test import TestCase from resolwe.flow.models import Process from resolwe.flow.utils import iterate_schema class ProcessFieldsTestCase(TestCase): def test_processor_types(self): procs = list(Process.objects.all()) types = {} errors_equals = set() errors_subtype = set()...
{ "repo_name": "genialis/resolwe-bio", "path": "resolwe_bio/tests/processes/test_processor.py", "copies": "1", "size": "1779", "license": "apache-2.0", "hash": 3741693419249753000, "line_mean": 34.58, "line_max": 99, "alpha_frac": 0.4867903316, "autogenerated": false, "ratio": 4.3817733990147785, ...
from django.test import TestCase from resrc.link.tests.factories import LinkFactory class LinkTestCase(TestCase): def test_model(self): """test link model exists""" link = LinkFactory() link.save() self.assertTrue(link.pk) def test_get_absolute_url(self): """test lin...
{ "repo_name": "sergiolimajr/resrc", "path": "resrc/link/tests/models_tests.py", "copies": "1", "size": "2096", "license": "mit", "hash": -2777903084783564300, "line_mean": 33.3606557377, "line_max": 102, "alpha_frac": 0.572519084, "autogenerated": false, "ratio": 3.4473684210526314, "config_tes...
from django.test import TestCase from rest_framework import generics, renderers, serializers, status from rest_framework.response import Response from rest_framework.test import APIRequestFactory from tests.models import BasicModel factory = APIRequestFactory() class BasicSerializer(serializers.ModelSerializer): ...
{ "repo_name": "kgeorgy/django-rest-framework", "path": "tests/browsable_api/test_form_rendering.py", "copies": "8", "size": "2795", "license": "bsd-2-clause", "hash": -6826420119423646000, "line_mean": 32.2738095238, "line_max": 85, "alpha_frac": 0.6615384615, "autogenerated": false, "ratio": 4.0...
from django.test import TestCase from rest_framework import serializers from .models import Bookmark, Note, Tag class TestGenericRelations(TestCase): def setUp(self): self.bookmark = Bookmark.objects.create(url='https://www.djangoproject.com/') Tag.objects.create(tagged_item=self.bookmark, tag='...
{ "repo_name": "tomchristie/django-rest-framework", "path": "tests/generic_relations/test_generic_relations.py", "copies": "5", "size": "2064", "license": "bsd-2-clause", "hash": 8798112618179387000, "line_mean": 31.25, "line_max": 85, "alpha_frac": 0.5649224806, "autogenerated": false, "ratio": 4...
from django.test import TestCase from rest_framework import serializers, status from rest_framework.decorators import api_view from rest_framework.response import Response from rest_framework.settings import api_settings from rest_framework.test import APIRequestFactory from rest_framework.views import APIView factor...
{ "repo_name": "dmwyatt/django-rest-framework", "path": "tests/test_validation_error.py", "copies": "15", "size": "3290", "license": "bsd-2-clause", "hash": 7575733719223242000, "line_mean": 31.5742574257, "line_max": 69, "alpha_frac": 0.6547112462, "autogenerated": false, "ratio": 4.3006535947712...
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": "davesque/django-rest-framework", "path": "tests/test_viewsets.py", "copies": "6", "size": "2256", "license": "bsd-2-clause", "hash": 1969565344055479600, "line_mean": 32.671641791, "line_max": 72, "alpha_frac": 0.6054964539, "autogenerated": false, "ratio": 4.101818181818182, "co...
from django.test import TestCase from rest_framework.reverse import reverse from rest_assured.testcases import UpdateAPITestCaseMixin from tests import mocks from tests.models import Stuff, RelatedStuff class TestUpdateTestCase(TestCase): def get_case(self, **kwargs): class MockUpdateTestCase(UpdateAPITe...
{ "repo_name": "ydaniv/django-rest-assured", "path": "tests/test_update.py", "copies": "2", "size": "3911", "license": "bsd-2-clause", "hash": 4452217008345351700, "line_mean": 38.11, "line_max": 87, "alpha_frac": 0.6563538737, "autogenerated": false, "ratio": 4.260348583877995, "config_test": t...
from django.test import TestCase from rest_framework.test import APITestCase from django.contrib.auth import get_user_model from activities.models import Activity import datetime import time from pprint import pprint import json import random User = get_user_model() class APIHeatMapTest(TestCase): def test_re...
{ "repo_name": "hellojerry/buddy", "path": "analytics/tests.py", "copies": "1", "size": "2012", "license": "mit", "hash": 8567927143707842000, "line_mean": 40.0612244898, "line_max": 78, "alpha_frac": 0.5735586481, "autogenerated": false, "ratio": 4.2717622080679405, "config_test": true, "has_...
from django.test import TestCase from reviewboard.changedescs.models import ChangeDescription class ChangeDescTests(TestCase): """Tests the ChangeDescription model.""" def testRecordString(self): """Testing record_field_change with a string value""" old_value = "abc" new_value = "def"...
{ "repo_name": "atagar/ReviewBoard", "path": "reviewboard/changedescs/tests.py", "copies": "4", "size": "4030", "license": "mit", "hash": -55655156054896700, "line_mean": 45.8604651163, "line_max": 80, "alpha_frac": 0.5791563275, "autogenerated": false, "ratio": 4.129098360655738, "config_test":...
from django.test import TestCase from rhodonea_mapper.api.serializers import ( RhodoneaDetailSerializer, LayerDetailSerializer, LayerSerializer, ) from tests.rhodonea_mapper.factories import ( RhodoneaFactory, ) class RhodoneaDetailsSerializerTests(TestCase): def test(self): rh = Rhodonea...
{ "repo_name": "eclectic-boy/rhodonea_mapper", "path": "tests/rhodonea_mapper/api/tests_serializers.py", "copies": "1", "size": "1619", "license": "bsd-3-clause", "hash": 4315861513557361700, "line_mean": 20.5866666667, "line_max": 48, "alpha_frac": 0.4441012971, "autogenerated": false, "ratio": 4...
from django.test import TestCase from rockit.core.holders import Holder class HolderTestCase(TestCase): def setUp(self): self.holder = Holder() def test_content_should_be_a_dictionary(self): self.assertTrue(isinstance(self.holder.get_content(), dict)) def test_content_should_contain_dat...
{ "repo_name": "acreations/rockit-server", "path": "rockit/core/tests/test_holder.py", "copies": "1", "size": "3132", "license": "mit", "hash": 4548970607887556000, "line_mean": 33.4175824176, "line_max": 78, "alpha_frac": 0.6408045977, "autogenerated": false, "ratio": 3.364124597207304, "config...
from django.test import TestCase from rockit.core import resolvers from rockit.core import models from rockit.core import holders class MixesNameResolverTestCase(TestCase): def setUp(self): self.association = models.Association.objects.create(name = 'my_node', namespace='test') self.holder = hold...
{ "repo_name": "acreations/rockit-server", "path": "rockit/core/tests/test_resolver_mixes_name.py", "copies": "1", "size": "1921", "license": "mit", "hash": 18194077809540732, "line_mean": 37.44, "line_max": 99, "alpha_frac": 0.5923997918, "autogenerated": false, "ratio": 4.16702819956616, "conf...
from django.test import TestCase from rockit.core.tasks import register from rockit.core.models import Node from rockit.core.models import Association class NodeRegisterTestCase(TestCase): def setUp(self): self.association = Association.objects.create(name = 'my_node', namespace='test') def test_it...
{ "repo_name": "acreations/rockit-server", "path": "rockit/core/tests/test_node_register.py", "copies": "1", "size": "1963", "license": "mit", "hash": 1265800146416104700, "line_mean": 29.2, "line_max": 90, "alpha_frac": 0.6551197147, "autogenerated": false, "ratio": 3.6760299625468167, "config_...
from django.test import TestCase from salmon.metrics.serializers import MetricSerializer from salmon.metrics import models class TestSerializer(TestCase): def test_single(self): data = {'source': 'test.example.com', 'name': 'load', 'value': 0.1} serializer = Metric...
{ "repo_name": "lincolnloop/salmon", "path": "salmon/metrics/tests/test_serializers.py", "copies": "1", "size": "1624", "license": "bsd-3-clause", "hash": 584767604607029800, "line_mean": 35.9090909091, "line_max": 74, "alpha_frac": 0.6034482759, "autogenerated": false, "ratio": 3.9901719901719903...
from django.test import TestCase from scavenger.api.models import Building, Room, Group, Person class BuildingModelTest(TestCase): """Test suite for building model.""" def test_string_representation(self): building = Building(number='22', name='University Commons', altern...
{ "repo_name": "vetaylor/scavenger", "path": "scavenger/api/tests/test_models.py", "copies": "1", "size": "2418", "license": "mit", "hash": 6444754970170624000, "line_mean": 36.78125, "line_max": 75, "alpha_frac": 0.6182795699, "autogenerated": false, "ratio": 4.098305084745762, "config_test": t...
from django.test import TestCase from scientific_mission.models import Type, ScientificMission, Route from person.models import Person from cities_light.models import City, Country, Region import datetime class TypeTest(TestCase): def test_type_string_representation(self): mission = 'Convenção anual' ...
{ "repo_name": "neuromat/nira", "path": "scientific_mission/tests/test_models.py", "copies": "1", "size": "3390", "license": "mpl-2.0", "hash": 6823888602743576000, "line_mean": 40.3170731707, "line_max": 116, "alpha_frac": 0.6003541913, "autogenerated": false, "ratio": 4.172413793103448, "confi...
from django.test import TestCase from seed.models import BuildingSnapshot class TestJsonManager(TestCase): def setUp(self): self.model = BuildingSnapshot.objects.create() self.model.extra_data = {'superdata': 'always here', 'ratio': 0.43} self.model.save() def test_contains(self): ...
{ "repo_name": "buildingenergy/buildingenergy-platform", "path": "seed/managers/tests/test_json_manager.py", "copies": "1", "size": "6767", "license": "apache-2.0", "hash": 6351153714449005000, "line_mean": 33.881443299, "line_max": 75, "alpha_frac": 0.5871139353, "autogenerated": false, "ratio": ...