desc
stringlengths 3
26.7k
| decl
stringlengths 11
7.89k
| bodies
stringlengths 8
553k
|
---|---|---|
'Test contrib.formtools.preview form submittal when form contains:
BooleanField(required=False)
Ticket: #6209 - When an unchecked BooleanField is previewed, the preview
form\'s hash would be computed with no value for ``bool1``. However, when
the preview form is rendered, the unchecked hidden BooleanField would be
rendered with the string value \'False\'. So when the preview form is
resubmitted, the hash would be computed with the value \'False\' for
``bool1``. We need to make sure the hashes are the same in both cases.'
| def test_bool_submit(self):
| self.test_data.update({u'stage': 2})
hash = self.preview.security_hash(None, TestForm(self.test_data))
self.test_data.update({u'hash': hash, u'bool1': u'False'})
with warnings.catch_warnings(record=True):
response = self.client.post(u'/preview/', self.test_data)
self.assertEqual(response.content, success_string_encoded)
|
'Test contrib.formtools.preview form submittal, using a correct
hash'
| def test_form_submit_good_hash(self):
| self.test_data.update({u'stage': 2})
response = self.client.post(u'/preview/', self.test_data)
self.assertNotEqual(response.content, success_string_encoded)
hash = utils.form_hmac(TestForm(self.test_data))
self.test_data.update({u'hash': hash})
response = self.client.post(u'/preview/', self.test_data)
self.assertEqual(response.content, success_string_encoded)
|
'Test contrib.formtools.preview form submittal does not proceed
if the hash is incorrect.'
| def test_form_submit_bad_hash(self):
| self.test_data.update({u'stage': 2})
response = self.client.post(u'/preview/', self.test_data)
self.assertEqual(response.status_code, 200)
self.assertNotEqual(response.content, success_string_encoded)
hash = (utils.form_hmac(TestForm(self.test_data)) + u'bad')
self.test_data.update({u'hash': hash})
response = self.client.post(u'/previewpreview/', self.test_data)
self.assertNotEqual(response.content, success_string_encoded)
|
'Regression test for #10034: the hash generation function should ignore
leading/trailing whitespace so as to be friendly to broken browsers that
submit it (usually in textareas).'
| def test_textfield_hash(self):
| f1 = HashTestForm({u'name': u'joe', u'bio': u'Speaking espa\xf1ol.'})
f2 = HashTestForm({u'name': u' joe', u'bio': u'Speaking espa\xf1ol. '})
hash1 = utils.form_hmac(f1)
hash2 = utils.form_hmac(f2)
self.assertEqual(hash1, hash2)
|
'Regression test for #10643: the security hash should allow forms with
empty_permitted = True, or forms where data has not changed.'
| def test_empty_permitted(self):
| f1 = HashTestBlankForm({})
f2 = HashTestForm({}, empty_permitted=True)
hash1 = utils.form_hmac(f1)
hash2 = utils.form_hmac(f2)
self.assertEqual(hash1, hash2)
|
'step should be zero for the first form'
| def test_step_starts_at_zero(self):
| response = self.client.get(u'/wizard1/')
self.assertEqual(0, response.context[u'step0'])
|
'step should be incremented when we go to the next page'
| def test_step_increments(self):
| response = self.client.post(u'/wizard1/', {u'0-field': u'test', u'wizard_step': u'0'})
self.assertEqual(1, response.context[u'step0'])
|
'Form should not advance if the hash is missing or bad'
| def test_bad_hash(self):
| response = self.client.post(u'/wizard1/', {u'0-field': u'test', u'1-field': u'test2', u'wizard_step': u'1'})
self.assertEqual(0, response.context[u'step0'])
|
'Form should advance if the hash is present and good, as calculated using
current method.'
| def test_good_hash(self):
| data = {u'0-field': u'test', u'1-field': u'test2', u'hash_0': {2: u'cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca', 3: u'9355d5dff22d49dbad58e46189982cec649f9f5b'}[pickle.HIGHEST_PROTOCOL], u'wizard_step': u'1'}
response = self.client.post(u'/wizard1/', data)
self.assertEqual(2, response.context[u'step0'])
|
'Regression test for ticket #11726.
Wizard should not raise Http404 when steps are added dynamically.'
| def test_11726(self):
| reached = [False]
that = self
class WizardWithProcessStep(TestWizardClass, ):
def process_step(self, request, form, step):
if (step == 0):
if (self.num_steps() < 2):
self.form_list.append(WizardPageTwoForm)
if (step == 1):
that.assertTrue(isinstance(form, WizardPageTwoForm))
reached[0] = True
wizard = WizardWithProcessStep([WizardPageOneForm])
data = {u'0-field': u'test', u'1-field': u'test2', u'hash_0': {2: u'cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca', 3: u'9355d5dff22d49dbad58e46189982cec649f9f5b'}[pickle.HIGHEST_PROTOCOL], u'wizard_step': u'1'}
wizard(DummyRequest(POST=data))
self.assertTrue(reached[0])
data = {u'0-field': u'test', u'1-field': u'test2', u'hash_0': {2: u'cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca', 3: u'9355d5dff22d49dbad58e46189982cec649f9f5b'}[pickle.HIGHEST_PROTOCOL], u'hash_1': {2: u'1e6f6315da42e62f33a30640ec7e007ad3fbf1a1', 3: u'c33142ef9d01b1beae238adf22c3c6c57328f51a'}[pickle.HIGHEST_PROTOCOL], u'wizard_step': u'2'}
self.assertRaises(http.Http404, wizard, DummyRequest(POST=data))
|
'Regression test for ticket #14498. All previous steps\' forms should be
validated.'
| def test_14498(self):
| reached = [False]
that = self
class WizardWithProcessStep(TestWizardClass, ):
def process_step(self, request, form, step):
that.assertTrue(form.is_valid())
reached[0] = True
wizard = WizardWithProcessStep([WizardPageOneForm, WizardPageTwoForm, WizardPageThreeForm])
data = {u'0-field': u'test', u'1-field': u'test2', u'hash_0': {2: u'cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca', 3: u'9355d5dff22d49dbad58e46189982cec649f9f5b'}[pickle.HIGHEST_PROTOCOL], u'wizard_step': u'1'}
wizard(DummyRequest(POST=data))
self.assertTrue(reached[0])
|
'Regression test for ticket #14576.
The form of the last step is not passed to the done method.'
| def test_14576(self):
| reached = [False]
that = self
class Wizard(TestWizardClass, ):
def done(self, request, form_list):
reached[0] = True
that.assertTrue((len(form_list) == 2))
wizard = Wizard([WizardPageOneForm, WizardPageTwoForm])
data = {u'0-field': u'test', u'1-field': u'test2', u'hash_0': {2: u'cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca', 3: u'9355d5dff22d49dbad58e46189982cec649f9f5b'}[pickle.HIGHEST_PROTOCOL], u'wizard_step': u'1'}
wizard(DummyRequest(POST=data))
self.assertTrue(reached[0])
|
'Regression test for ticket #15075. Allow modifying wizard\'s form_list
in process_step.'
| def test_15075(self):
| reached = [False]
that = self
class WizardWithProcessStep(TestWizardClass, ):
def process_step(self, request, form, step):
if (step == 0):
self.form_list[1] = WizardPageTwoAlternativeForm
if (step == 1):
that.assertTrue(isinstance(form, WizardPageTwoAlternativeForm))
reached[0] = True
wizard = WizardWithProcessStep([WizardPageOneForm, WizardPageTwoForm, WizardPageThreeForm])
data = {u'0-field': u'test', u'1-field': u'test2', u'hash_0': {2: u'cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca', 3: u'9355d5dff22d49dbad58e46189982cec649f9f5b'}[pickle.HIGHEST_PROTOCOL], u'wizard_step': u'1'}
wizard(DummyRequest(POST=data))
self.assertTrue(reached[0])
|
'Pull the appropriate field data from the context to pass to the next wizard step'
| def grab_field_data(self, response):
| previous_fields = parse_html(response.context[u'previous_fields'])
fields = {u'wizard_step': response.context[u'step0']}
for input_field in previous_fields:
input_attrs = dict(input_field.attributes)
fields[input_attrs[u'name']] = input_attrs[u'value']
return fields
|
'Helper function to test each step of the wizard
- Make sure the call succeeded
- Make sure response is the proper step number
- return the result from the post for the next step'
| def check_wizard_step(self, response, step_no):
| step_count = len(self.wizard_step_data)
self.assertContains(response, (u'Step %d of %d' % (step_no, step_count)))
data = self.grab_field_data(response)
data.update(self.wizard_step_data[(step_no - 1)])
return self.client.post(u'/wizard2/', data)
|
'Returns the ContentType object for a given model, creating the
ContentType if necessary. Lookups are cached so that subsequent lookups
for the same model don\'t hit the database.'
| def get_for_model(self, model, for_concrete_model=True):
| opts = self._get_opts(model, for_concrete_model)
try:
ct = self._get_from_cache(opts)
except KeyError:
(ct, created) = self.get_or_create(app_label=opts.app_label, model=opts.object_name.lower(), defaults={'name': smart_text(opts.verbose_name_raw)})
self._add_to_cache(self.db, ct)
return ct
|
'Given *models, returns a dictionary mapping {model: content_type}.'
| def get_for_models(self, *models, **kwargs):
| for_concrete_models = kwargs.pop('for_concrete_models', True)
results = {}
needed_app_labels = set()
needed_models = set()
needed_opts = set()
for model in models:
opts = self._get_opts(model, for_concrete_models)
try:
ct = self._get_from_cache(opts)
except KeyError:
needed_app_labels.add(opts.app_label)
needed_models.add(opts.object_name.lower())
needed_opts.add(opts)
else:
results[model] = ct
if needed_opts:
cts = self.filter(app_label__in=needed_app_labels, model__in=needed_models)
for ct in cts:
model = ct.model_class()
if (model._meta in needed_opts):
results[model] = ct
needed_opts.remove(model._meta)
self._add_to_cache(self.db, ct)
for opts in needed_opts:
ct = self.create(app_label=opts.app_label, model=opts.object_name.lower(), name=smart_text(opts.verbose_name_raw))
self._add_to_cache(self.db, ct)
results[ct.model_class()] = ct
return results
|
'Lookup a ContentType by ID. Uses the same shared cache as get_for_model
(though ContentTypes are obviously not created on-the-fly by get_by_id).'
| def get_for_id(self, id):
| try:
ct = self.__class__._cache[self.db][id]
except KeyError:
ct = self.get(pk=id)
self._add_to_cache(self.db, ct)
return ct
|
'Clear out the content-type cache. This needs to happen during database
flushes to prevent caching of "stale" content type IDs (see
django.contrib.contenttypes.management.update_contenttypes for where
this gets called).'
| def clear_cache(self):
| self.__class__._cache.clear()
|
'Insert a ContentType into the cache.'
| def _add_to_cache(self, using, ct):
| model = ct.model_class()
key = (model._meta.app_label, model._meta.object_name.lower())
self.__class__._cache.setdefault(using, {})[key] = ct
self.__class__._cache.setdefault(using, {})[ct.id] = ct
|
'Returns the Python model class for this type of content.'
| def model_class(self):
| from django.db import models
return models.get_model(self.app_label, self.model, only_installed=False)
|
'Returns an object of this type for the keyword arguments given.
Basically, this is a proxy around this object_type\'s get_object() model
method. The ObjectNotExist exception, if thrown, will not be caught,
so code that calls this method should catch it.'
| def get_object_for_this_type(self, **kwargs):
| return self.model_class()._base_manager.using(self._state.db).get(**kwargs)
|
'Returns all objects of this type for the keyword arguments given.'
| def get_all_objects_for_this_type(self, **kwargs):
| return self.model_class()._base_manager.using(self._state.db).filter(**kwargs)
|
'Handles initializing an object with the generic FK instaed of
content-type/object-id fields.'
| def instance_pre_init(self, signal, sender, args, kwargs, **_kwargs):
| if (self.name in kwargs):
value = kwargs.pop(self.name)
kwargs[self.ct_field] = self.get_content_type(obj=value)
kwargs[self.fk_field] = value._get_pk_val()
|
'Return an extra filter to the queryset so that the results are filtered
on the appropriate content type.'
| def extra_filters(self, pieces, pos, negate):
| if negate:
return []
ContentType = get_model(u'contenttypes', u'contenttype')
content_type = ContentType.objects.get_for_model(self.model)
prefix = u'__'.join(pieces[:(pos + 1)])
return [((u'%s__%s' % (prefix, self.content_type_field_name)), content_type)]
|
'Return all objects related to ``objs`` via this ``GenericRelation``.'
| def bulk_related_objects(self, objs, using=DEFAULT_DB_ALIAS):
| return self.rel.to._base_manager.db_manager(using).filter(**{(u'%s__pk' % self.content_type_field_name): ContentType.objects.db_manager(using).get_for_model(self.model).pk, (u'%s__in' % self.object_id_field_name): [obj.pk for obj in objs]})
|
'Make sure that the content type cache (see ContentTypeManager)
works correctly. Lookups for a particular content type -- by model, ID
or natural key -- should hit the database only on the first lookup.'
| def test_lookup_cache(self):
| with self.assertNumQueries(1):
ContentType.objects.get_for_model(ContentType)
with self.assertNumQueries(0):
ct = ContentType.objects.get_for_model(ContentType)
with self.assertNumQueries(0):
ContentType.objects.get_for_id(ct.id)
with self.assertNumQueries(0):
ContentType.objects.get_by_natural_key(u'contenttypes', u'contenttype')
ContentType.objects.clear_cache()
with self.assertNumQueries(1):
ContentType.objects.get_for_model(ContentType)
ContentType.objects.clear_cache()
with self.assertNumQueries(1):
ContentType.objects.get_by_natural_key(u'contenttypes', u'contenttype')
with self.assertNumQueries(0):
ContentType.objects.get_by_natural_key(u'contenttypes', u'contenttype')
|
'Make sure the `for_concrete_model` kwarg correctly works
with concrete, proxy and deferred models'
| def test_get_for_concrete_model(self):
| concrete_model_ct = ContentType.objects.get_for_model(ConcreteModel)
self.assertEqual(concrete_model_ct, ContentType.objects.get_for_model(ProxyModel))
self.assertEqual(concrete_model_ct, ContentType.objects.get_for_model(ConcreteModel, for_concrete_model=False))
proxy_model_ct = ContentType.objects.get_for_model(ProxyModel, for_concrete_model=False)
self.assertNotEqual(concrete_model_ct, proxy_model_ct)
ConcreteModel.objects.create(name=u'Concrete')
DeferredConcreteModel = ConcreteModel.objects.only(u'pk').get().__class__
DeferredProxyModel = ProxyModel.objects.only(u'pk').get().__class__
self.assertEqual(concrete_model_ct, ContentType.objects.get_for_model(DeferredConcreteModel))
self.assertEqual(concrete_model_ct, ContentType.objects.get_for_model(DeferredConcreteModel, for_concrete_model=False))
self.assertEqual(concrete_model_ct, ContentType.objects.get_for_model(DeferredProxyModel))
self.assertEqual(proxy_model_ct, ContentType.objects.get_for_model(DeferredProxyModel, for_concrete_model=False))
|
'Make sure the `for_concrete_models` kwarg correctly works
with concrete, proxy and deferred models.'
| def test_get_for_concrete_models(self):
| concrete_model_ct = ContentType.objects.get_for_model(ConcreteModel)
cts = ContentType.objects.get_for_models(ConcreteModel, ProxyModel)
self.assertEqual(cts, {ConcreteModel: concrete_model_ct, ProxyModel: concrete_model_ct})
proxy_model_ct = ContentType.objects.get_for_model(ProxyModel, for_concrete_model=False)
cts = ContentType.objects.get_for_models(ConcreteModel, ProxyModel, for_concrete_models=False)
self.assertEqual(cts, {ConcreteModel: concrete_model_ct, ProxyModel: proxy_model_ct})
ConcreteModel.objects.create(name=u'Concrete')
DeferredConcreteModel = ConcreteModel.objects.only(u'pk').get().__class__
DeferredProxyModel = ProxyModel.objects.only(u'pk').get().__class__
cts = ContentType.objects.get_for_models(DeferredConcreteModel, DeferredProxyModel)
self.assertEqual(cts, {DeferredConcreteModel: concrete_model_ct, DeferredProxyModel: concrete_model_ct})
cts = ContentType.objects.get_for_models(DeferredConcreteModel, DeferredProxyModel, for_concrete_models=False)
self.assertEqual(cts, {DeferredConcreteModel: concrete_model_ct, DeferredProxyModel: proxy_model_ct})
|
'Check that the shortcut view (used for the admin "view on site"
functionality) returns a complete URL regardless of whether the sites
framework is installed'
| @override_settings(ALLOWED_HOSTS=[u'example.com'])
def test_shortcut_view(self):
| request = HttpRequest()
request.META = {u'SERVER_NAME': u'Example.com', u'SERVER_PORT': u'80'}
user_ct = ContentType.objects.get_for_model(FooWithUrl)
obj = FooWithUrl.objects.create(name=u'john')
if Site._meta.installed:
response = shortcut(request, user_ct.id, obj.id)
self.assertEqual((u'http://%s/users/john/' % get_current_site(request).domain), response._headers.get(u'location')[1])
Site._meta.installed = False
response = shortcut(request, user_ct.id, obj.id)
self.assertEqual(u'http://Example.com/users/john/', response._headers.get(u'location')[1])
|
'Check that the shortcut view (used for the admin "view on site"
functionality) returns 404 when get_absolute_url is not defined.'
| def test_shortcut_view_without_get_absolute_url(self):
| request = HttpRequest()
request.META = {u'SERVER_NAME': u'Example.com', u'SERVER_PORT': u'80'}
user_ct = ContentType.objects.get_for_model(FooWithoutUrl)
obj = FooWithoutUrl.objects.create(name=u'john')
self.assertRaises(Http404, shortcut, request, user_ct.id, obj.id)
|
'Check that the shortcut view does not catch an AttributeError raised
by the model\'s get_absolute_url method.
Refs #8997.'
| def test_shortcut_view_with_broken_get_absolute_url(self):
| request = HttpRequest()
request.META = {u'SERVER_NAME': u'Example.com', u'SERVER_PORT': u'80'}
user_ct = ContentType.objects.get_for_model(FooWithBrokenAbsoluteUrl)
obj = FooWithBrokenAbsoluteUrl.objects.create(name=u'john')
self.assertRaises(AttributeError, shortcut, request, user_ct.id, obj.id)
|
'Ensures that displaying content types in admin (or anywhere) doesn\'t
break on leftover content type records in the DB for which no model
is defined anymore.'
| def test_missing_model(self):
| ct = ContentType.objects.create(name=u'Old model', app_label=u'contenttypes', model=u'OldModel')
self.assertEqual(six.text_type(ct), u'Old model')
|
'Returns the storage backend, setting its loaded data to the ``data``
argument.
This method avoids the storage ``_get`` method from getting called so
that other parts of the storage backend can be tested independent of
the message retrieval logic.'
| def get_storage(self, data=None):
| storage = self.storage_class(self.get_request())
storage._loaded_data = (data or [])
return storage
|
'With the message middleware enabled, tests that messages are properly
stored and then retrieved across the full request/redirect/response
cycle.'
| @override_settings(MESSAGE_LEVEL=constants.DEBUG)
def test_full_request_response_cycle(self):
| data = {'messages': [('Test message %d' % x) for x in range(5)]}
show_url = reverse('django.contrib.messages.tests.urls.show')
for level in ('debug', 'info', 'success', 'warning', 'error'):
add_url = reverse('django.contrib.messages.tests.urls.add', args=(level,))
response = self.client.post(add_url, data, follow=True)
self.assertRedirects(response, show_url)
self.assertTrue(('messages' in response.context))
messages = [Message(self.levels[level], msg) for msg in data['messages']]
self.assertEqual(list(response.context['messages']), messages)
for msg in data['messages']:
self.assertContains(response, msg)
|
'Tests that messages persist properly when multiple POSTs are made
before a GET.'
| @override_settings(MESSAGE_LEVEL=constants.DEBUG)
def test_multiple_posts(self):
| data = {'messages': [('Test message %d' % x) for x in range(5)]}
show_url = reverse('django.contrib.messages.tests.urls.show')
messages = []
for level in ('debug', 'info', 'success', 'warning', 'error'):
messages.extend([Message(self.levels[level], msg) for msg in data['messages']])
add_url = reverse('django.contrib.messages.tests.urls.add', args=(level,))
self.client.post(add_url, data)
response = self.client.get(show_url)
self.assertTrue(('messages' in response.context))
self.assertEqual(list(response.context['messages']), messages)
for msg in data['messages']:
self.assertContains(response, msg)
|
'Tests that, when the middleware is disabled, an exception is raised
when one attempts to store a message.'
| @override_settings(INSTALLED_APPS=filter((lambda app: (app != 'django.contrib.messages')), settings.INSTALLED_APPS), MIDDLEWARE_CLASSES=filter((lambda m: ('MessageMiddleware' not in m)), settings.MIDDLEWARE_CLASSES), TEMPLATE_CONTEXT_PROCESSORS=filter((lambda p: ('context_processors.messages' not in p)), settings.TEMPLATE_CONTEXT_PROCESSORS), MESSAGE_LEVEL=constants.DEBUG)
def test_middleware_disabled(self):
| data = {'messages': [('Test message %d' % x) for x in range(5)]}
show_url = reverse('django.contrib.messages.tests.urls.show')
for level in ('debug', 'info', 'success', 'warning', 'error'):
add_url = reverse('django.contrib.messages.tests.urls.add', args=(level,))
self.assertRaises(MessageFailure, self.client.post, add_url, data, follow=True)
|
'Tests that, when the middleware is disabled, an exception is not
raised if \'fail_silently\' = True'
| @override_settings(INSTALLED_APPS=filter((lambda app: (app != 'django.contrib.messages')), settings.INSTALLED_APPS), MIDDLEWARE_CLASSES=filter((lambda m: ('MessageMiddleware' not in m)), settings.MIDDLEWARE_CLASSES), TEMPLATE_CONTEXT_PROCESSORS=filter((lambda p: ('context_processors.messages' not in p)), settings.TEMPLATE_CONTEXT_PROCESSORS), MESSAGE_LEVEL=constants.DEBUG)
def test_middleware_disabled_fail_silently(self):
| data = {'messages': [('Test message %d' % x) for x in range(5)], 'fail_silently': True}
show_url = reverse('django.contrib.messages.tests.urls.show')
for level in ('debug', 'info', 'success', 'warning', 'error'):
add_url = reverse('django.contrib.messages.tests.urls.add', args=(level,))
response = self.client.post(add_url, data, follow=True)
self.assertRedirects(response, show_url)
self.assertFalse(('messages' in response.context))
|
'Returns the number of messages being stored after a
``storage.update()`` call.'
| def stored_messages_count(self, storage, response):
| raise NotImplementedError('This method must be set by a subclass.')
|
'Tests that reading the existing storage doesn\'t cause the data to be
lost.'
| def test_existing_read(self):
| storage = self.get_existing_storage()
self.assertFalse(storage.used)
data = list(storage)
self.assertTrue(storage.used)
self.assertEqual(data, list(storage))
|
'Ensure that CookieStorage honors SESSION_COOKIE_DOMAIN.
Refs #15618.'
| def test_domain(self):
| storage = self.get_storage()
response = self.get_response()
storage.add(constants.INFO, 'test')
storage.update(response)
self.assertTrue(('test' in response.cookies['messages'].value))
self.assertEqual(response.cookies['messages']['domain'], '.example.com')
self.assertEqual(response.cookies['messages']['expires'], '')
storage = self.get_storage()
response = self.get_response()
storage.add(constants.INFO, 'test')
for m in storage:
pass
storage.update(response)
self.assertEqual(response.cookies['messages'].value, '')
self.assertEqual(response.cookies['messages']['domain'], '.example.com')
self.assertEqual(response.cookies['messages']['expires'], 'Thu, 01-Jan-1970 00:00:00 GMT')
|
'Tests that, if the data exceeds what is allowed in a cookie, older
messages are removed before saving (and returned by the ``update``
method).'
| def test_max_cookie_length(self):
| storage = self.get_storage()
response = self.get_response()
msg_size = int((((CookieStorage.max_cookie_size - 54) / 4.5) - 37))
for i in range(5):
storage.add(constants.INFO, (str(i) * msg_size))
unstored_messages = storage.update(response)
cookie_storing = self.stored_messages_count(storage, response)
self.assertEqual(cookie_storing, 4)
self.assertEqual(len(unstored_messages), 1)
self.assertTrue((unstored_messages[0].message == ('0' * msg_size)))
|
'Tests that a complex nested data structure containing Message
instances is properly encoded/decoded by the custom JSON
encoder/decoder classes.'
| def test_json_encoder_decoder(self):
| messages = [{'message': Message(constants.INFO, 'Test message'), 'message_list': ([Message(constants.INFO, 'message %s') for x in range(5)] + [{'another-message': Message(constants.ERROR, 'error')}])}, Message(constants.INFO, 'message %s')]
encoder = MessageEncoder(separators=(',', ':'))
value = encoder.encode(messages)
decoded_messages = json.loads(value, cls=MessageDecoder)
self.assertEqual(messages, decoded_messages)
|
'Tests that a message containing SafeData is keeping its safe status when
retrieved from the message storage.'
| def test_safedata(self):
| def encode_decode(data):
message = Message(constants.DEBUG, data)
encoded = storage._encode(message)
decoded = storage._decode(encoded)
return decoded.message
storage = self.get_storage()
self.assertIsInstance(encode_decode(mark_safe('<b>Hello Django!</b>')), SafeData)
self.assertNotIsInstance(encode_decode('<b>Hello Django!</b>'), SafeData)
|
'Tests that a message containing SafeData is keeping its safe status when
retrieved from the message storage.'
| def test_safedata(self):
| storage = self.get_storage()
message = Message(constants.DEBUG, mark_safe('<b>Hello Django!</b>'))
set_session_data(storage, [message])
self.assertIsInstance(list(storage)[0].message, SafeData)
|
'Return the storage totals from both cookie and session backends.'
| def stored_messages_count(self, storage, response):
| total = (self.stored_cookie_messages_count(storage, response) + self.stored_session_messages_count(storage, response))
return total
|
'Confirms that:
(1) A short number of messages whose data size doesn\'t exceed what is
allowed in a cookie will all be stored in the CookieBackend.
(2) If the CookieBackend can store all messages, the SessionBackend
won\'t be written to at all.'
| def test_no_fallback(self):
| storage = self.get_storage()
response = self.get_response()
self.get_session_storage(storage)._store = None
for i in range(5):
storage.add(constants.INFO, (str(i) * 100))
storage.update(response)
cookie_storing = self.stored_cookie_messages_count(storage, response)
self.assertEqual(cookie_storing, 5)
session_storing = self.stored_session_messages_count(storage, response)
self.assertEqual(session_storing, 0)
|
'Confirms that, if the data exceeds what is allowed in a cookie,
messages which did not fit are stored in the SessionBackend.'
| def test_session_fallback(self):
| storage = self.get_storage()
response = self.get_response()
msg_size = int((((CookieStorage.max_cookie_size - 54) / 4.5) - 37))
for i in range(5):
storage.add(constants.INFO, (str(i) * msg_size))
storage.update(response)
cookie_storing = self.stored_cookie_messages_count(storage, response)
self.assertEqual(cookie_storing, 4)
session_storing = self.stored_session_messages_count(storage, response)
self.assertEqual(session_storing, 1)
|
'Confirms that large messages, none of which fit in a cookie, are stored
in the SessionBackend (and nothing is stored in the CookieBackend).'
| def test_session_fallback_only(self):
| storage = self.get_storage()
response = self.get_response()
storage.add(constants.INFO, ('x' * 5000))
storage.update(response)
cookie_storing = self.stored_cookie_messages_count(storage, response)
self.assertEqual(cookie_storing, 0)
session_storing = self.stored_session_messages_count(storage, response)
self.assertEqual(session_storing, 1)
|
'Makes sure that the response middleware is tolerant of messages not
existing on request.'
| def test_response_without_messages(self):
| request = http.HttpRequest()
response = http.HttpResponse()
self.middleware.process_response(request, response)
|
'Prepares the message for serialization by forcing the ``message``
and ``extra_tags`` to unicode in case they are lazy translations.
Known "safe" types (None, int, etc.) are not converted (see Django\'s
``force_text`` implementation for details).'
| def _prepare(self):
| self.message = force_text(self.message, strings_only=True)
self.extra_tags = force_text(self.extra_tags, strings_only=True)
|
'Returns a list of loaded messages, retrieving them first if they have
not been loaded yet.'
| @property
def _loaded_messages(self):
| if (not hasattr(self, u'_loaded_data')):
(messages, all_retrieved) = self._get()
self._loaded_data = (messages or [])
return self._loaded_data
|
'Retrieves a list of stored messages. Returns a tuple of the messages
and a flag indicating whether or not all the messages originally
intended to be stored in this storage were, in fact, stored and
retrieved; e.g., ``(messages, all_retrieved)``.
**This method must be implemented by a subclass.**
If it is possible to tell if the backend was not used (as opposed to
just containing no messages) then ``None`` should be returned in
place of ``messages``.'
| def _get(self, *args, **kwargs):
| raise NotImplementedError()
|
'Stores a list of messages, returning a list of any messages which could
not be stored.
One type of object must be able to be stored, ``Message``.
**This method must be implemented by a subclass.**'
| def _store(self, messages, response, *args, **kwargs):
| raise NotImplementedError()
|
'Prepares a list of messages for storage.'
| def _prepare_messages(self, messages):
| for message in messages:
message._prepare()
|
'Stores all unread messages.
If the backend has yet to be iterated, previously stored messages will
be stored again. Otherwise, only messages added after the last
iteration will be stored.'
| def update(self, response):
| self._prepare_messages(self._queued_messages)
if self.used:
return self._store(self._queued_messages, response)
elif self.added_new:
messages = (self._loaded_messages + self._queued_messages)
return self._store(messages, response)
|
'Queues a message to be stored.
The message is only queued if it contained something and its level is
not less than the recording level (``self.level``).'
| def add(self, level, message, extra_tags=u''):
| if (not message):
return
level = int(level)
if (level < self.level):
return
self.added_new = True
message = Message(level, message, extra_tags=extra_tags)
self._queued_messages.append(message)
|
'Returns the minimum recorded level.
The default level is the ``MESSAGE_LEVEL`` setting. If this is
not found, the ``INFO`` level is used.'
| def _get_level(self):
| if (not hasattr(self, u'_level')):
self._level = getattr(settings, u'MESSAGE_LEVEL', constants.INFO)
return self._level
|
'Sets a custom minimum recorded level.
If set to ``None``, the default level will be used (see the
``_get_level`` method).'
| def _set_level(self, value=None):
| if ((value is None) and hasattr(self, u'_level')):
del self._level
else:
self._level = int(value)
|
'Retrieves a list of messages from the messages cookie. If the
not_finished sentinel value is found at the end of the message list,
remove it and return a result indicating that not all messages were
retrieved by this storage.'
| def _get(self, *args, **kwargs):
| data = self.request.COOKIES.get(self.cookie_name)
messages = self._decode(data)
all_retrieved = (not (messages and (messages[(-1)] == self.not_finished)))
if (messages and (not all_retrieved)):
messages.pop()
return (messages, all_retrieved)
|
'Either sets the cookie with the encoded data if there is any data to
store, or deletes the cookie.'
| def _update_cookie(self, encoded_data, response):
| if encoded_data:
response.set_cookie(self.cookie_name, encoded_data, domain=settings.SESSION_COOKIE_DOMAIN)
else:
response.delete_cookie(self.cookie_name, domain=settings.SESSION_COOKIE_DOMAIN)
|
'Stores the messages to a cookie, returning a list of any messages which
could not be stored.
If the encoded data is larger than ``max_cookie_size``, removes
messages until the data fits (these are the messages which are
returned), and add the not_finished sentinel value to indicate as much.'
| def _store(self, messages, response, remove_oldest=True, *args, **kwargs):
| unstored_messages = []
encoded_data = self._encode(messages)
if self.max_cookie_size:
cookie = SimpleCookie()
def stored_length(val):
return len(cookie.value_encode(val)[1])
while (encoded_data and (stored_length(encoded_data) > self.max_cookie_size)):
if remove_oldest:
unstored_messages.append(messages.pop(0))
else:
unstored_messages.insert(0, messages.pop())
encoded_data = self._encode((messages + [self.not_finished]), encode_empty=unstored_messages)
self._update_cookie(encoded_data, response)
return unstored_messages
|
'Creates an HMAC/SHA1 hash based on the value and the project setting\'s
SECRET_KEY, modified to make it unique for the present purpose.'
| def _hash(self, value):
| key_salt = 'django.contrib.messages'
return salted_hmac(key_salt, value).hexdigest()
|
'Returns an encoded version of the messages list which can be stored as
plain text.
Since the data will be retrieved from the client-side, the encoded data
also contains a hash to ensure that the data was not tampered with.'
| def _encode(self, messages, encode_empty=False):
| if (messages or encode_empty):
encoder = MessageEncoder(separators=(',', ':'))
value = encoder.encode(messages)
return ('%s$%s' % (self._hash(value), value))
|
'Safely decodes a encoded text stream back into a list of messages.
If the encoded text stream contained an invalid hash or was in an
invalid format, ``None`` is returned.'
| def _decode(self, data):
| if (not data):
return None
bits = data.split('$', 1)
if (len(bits) == 2):
(hash, value) = bits
if constant_time_compare(hash, self._hash(value)):
try:
return json.loads(value, cls=MessageDecoder)
except ValueError:
pass
self.used = True
return None
|
'Retrieves a list of messages from the request\'s session. This storage
always stores everything it is given, so return True for the
all_retrieved flag.'
| def _get(self, *args, **kwargs):
| return (self.request.session.get(self.session_key), True)
|
'Stores a list of messages to the request\'s session.'
| def _store(self, messages, response, *args, **kwargs):
| if messages:
self.request.session[self.session_key] = messages
else:
self.request.session.pop(self.session_key, None)
return []
|
'Gets a single list of messages from all storage backends.'
| def _get(self, *args, **kwargs):
| all_messages = []
for storage in self.storages:
(messages, all_retrieved) = storage._get()
if (messages is None):
break
if messages:
self._used_storages.add(storage)
all_messages.extend(messages)
if all_retrieved:
break
return (all_messages, all_retrieved)
|
'Stores the messages, returning any unstored messages after trying all
backends.
For each storage backend, any messages not stored are passed on to the
next backend.'
| def _store(self, messages, response, *args, **kwargs):
| for storage in self.storages:
if messages:
messages = storage._store(messages, response, remove_oldest=False)
elif (storage in self._used_storages):
storage._store([], response)
self._used_storages.remove(storage)
return messages
|
'Updates the storage backend (i.e., saves the messages).
If not all messages could not be stored and ``DEBUG`` is ``True``, a
``ValueError`` is raised.'
| def process_response(self, request, response):
| if hasattr(request, '_messages'):
unstored_messages = request._messages.update(response)
if (unstored_messages and settings.DEBUG):
raise ValueError('Not all temporary messages could be stored.')
return response
|
'Escape CR and LF characters, and limit length.
RFC 2822\'s hard limit is 998 characters per line. So, minus "Subject: "
the actual subject must be no longer than 989 characters.'
| def format_subject(self, subject):
| formatted_subject = subject.replace('\n', '\\n').replace('\r', '\\r')
return formatted_subject[:989]
|
'Adds an item to the feed. All args are expected to be Python Unicode
objects except pubdate, which is a datetime.datetime object, and
enclosure, which is an instance of the Enclosure class.'
| def add_item(self, title, link, description, author_email=None, author_name=None, author_link=None, pubdate=None, comments=None, unique_id=None, enclosure=None, categories=(), item_copyright=None, ttl=None, **kwargs):
| to_unicode = (lambda s: force_text(s, strings_only=True))
if categories:
categories = [to_unicode(c) for c in categories]
if (ttl is not None):
ttl = force_text(ttl)
item = {u'title': to_unicode(title), u'link': iri_to_uri(link), u'description': to_unicode(description), u'author_email': to_unicode(author_email), u'author_name': to_unicode(author_name), u'author_link': iri_to_uri(author_link), u'pubdate': pubdate, u'comments': to_unicode(comments), u'unique_id': to_unicode(unique_id), u'enclosure': enclosure, u'categories': (categories or ()), u'item_copyright': to_unicode(item_copyright), u'ttl': ttl}
item.update(kwargs)
self.items.append(item)
|
'Return extra attributes to place on the root (i.e. feed/channel) element.
Called from write().'
| def root_attributes(self):
| return {}
|
'Add elements in the root (i.e. feed/channel) element. Called
from write().'
| def add_root_elements(self, handler):
| pass
|
'Return extra attributes to place on each item (i.e. item/entry) element.'
| def item_attributes(self, item):
| return {}
|
'Add elements on each item (i.e. item/entry) element.'
| def add_item_elements(self, handler, item):
| pass
|
'Outputs the feed in the given encoding to outfile, which is a file-like
object. Subclasses should override this.'
| def write(self, outfile, encoding):
| raise NotImplementedError
|
'Returns the feed in the given encoding as a string.'
| def writeString(self, encoding):
| s = StringIO()
self.write(s, encoding)
return s.getvalue()
|
'Returns the latest item\'s pubdate. If none of them have a pubdate,
this returns the current date/time.'
| def latest_post_date(self):
| updates = [i[u'pubdate'] for i in self.items if (i[u'pubdate'] is not None)]
if (len(updates) > 0):
updates.sort()
return updates[(-1)]
else:
return datetime.datetime.now()
|
'All args are expected to be Python Unicode objects'
| def __init__(self, url, length, mime_type):
| (self.length, self.mime_type) = (length, mime_type)
self.url = iri_to_uri(url)
|
'Create an instance of the class that will use the named test
method when executed. Raises a ValueError if the instance does
not have a method with the specified name.'
| def __init__(self, methodName='runTest'):
| self._testMethodName = methodName
self._resultForDoCleanups = None
try:
testMethod = getattr(self, methodName)
except AttributeError:
raise ValueError(('no such test method in %s: %s' % (self.__class__, methodName)))
self._testMethodDoc = testMethod.__doc__
self._cleanups = []
self._type_equality_funcs = _TypeEqualityDict(self)
self.addTypeEqualityFunc(dict, 'assertDictEqual')
self.addTypeEqualityFunc(list, 'assertListEqual')
self.addTypeEqualityFunc(tuple, 'assertTupleEqual')
self.addTypeEqualityFunc(set, 'assertSetEqual')
self.addTypeEqualityFunc(frozenset, 'assertSetEqual')
self.addTypeEqualityFunc(unicode, 'assertMultiLineEqual')
|
'Add a type specific assertEqual style function to compare a type.
This method is for use by TestCase subclasses that need to register
their own type equality functions to provide nicer error messages.
Args:
typeobj: The data type to call this function on when both values
are of the same type in assertEqual().
function: The callable taking two arguments and an optional
msg= argument that raises self.failureException with a
useful error message when the two arguments are not equal.'
| def addTypeEqualityFunc(self, typeobj, function):
| self._type_equality_funcs[typeobj] = function
|
'Add a function, with arguments, to be called when the test is
completed. Functions added are called on a LIFO basis and are
called after tearDown on test failure or success.
Cleanup items are called even if setUp fails (unlike tearDown).'
| def addCleanup(self, function, *args, **kwargs):
| self._cleanups.append((function, args, kwargs))
|
'Returns a one-line description of the test, or None if no
description has been provided.
The default implementation of this method returns the first line of
the specified test method\'s docstring.'
| def shortDescription(self):
| doc = self._testMethodDoc
return ((doc and doc.split('\n')[0].strip()) or None)
|
'Execute all cleanup functions. Normally called for you after
tearDown.'
| def doCleanups(self):
| result = self._resultForDoCleanups
ok = True
while self._cleanups:
(function, args, kwargs) = self._cleanups.pop((-1))
try:
function(*args, **kwargs)
except Exception:
ok = False
result.addError(self, sys.exc_info())
return ok
|
'Run the test without collecting errors in a TestResult'
| def debug(self):
| self.setUp()
getattr(self, self._testMethodName)()
self.tearDown()
while self._cleanups:
(function, args, kwargs) = self._cleanups.pop((-1))
function(*args, **kwargs)
|
'Skip this test.'
| def skipTest(self, reason):
| raise SkipTest(reason)
|
'Fail immediately, with the given message.'
| def fail(self, msg=None):
| raise self.failureException(msg)
|
'Fail the test if the expression is true.'
| def assertFalse(self, expr, msg=None):
| if expr:
msg = self._formatMessage(msg, ('%s is not False' % safe_repr(expr)))
raise self.failureException(msg)
|
'Fail the test unless the expression is true.'
| def assertTrue(self, expr, msg=None):
| if (not expr):
msg = self._formatMessage(msg, ('%s is not True' % safe_repr(expr)))
raise self.failureException(msg)
|
'Honour the longMessage attribute when generating failure messages.
If longMessage is False this means:
* Use only an explicit message if it is provided
* Otherwise use the standard message for the assert
If longMessage is True:
* Use the standard message
* If an explicit message is provided, plus \' : \' and the explicit message'
| def _formatMessage(self, msg, standardMsg):
| if (not self.longMessage):
return (msg or standardMsg)
if (msg is None):
return standardMsg
try:
return ('%s : %s' % (standardMsg, msg))
except UnicodeDecodeError:
return ('%s : %s' % (safe_str(standardMsg), safe_str(msg)))
|
'Fail unless an exception of class excClass is thrown
by callableObj when invoked with arguments args and keyword
arguments kwargs. If a different type of exception is
thrown, it will not be caught, and the test case will be
deemed to have suffered an error, exactly as for an
unexpected exception.
If called with callableObj omitted or None, will return a
context object used like this::
with self.assertRaises(SomeException):
do_something()
The context manager keeps a reference to the exception as
the \'exception\' attribute. This allows you to inspect the
exception after the assertion::
with self.assertRaises(SomeException) as cm:
do_something()
the_exception = cm.exception
self.assertEqual(the_exception.error_code, 3)'
| def assertRaises(self, excClass, callableObj=None, *args, **kwargs):
| if (callableObj is None):
return _AssertRaisesContext(excClass, self)
try:
callableObj(*args, **kwargs)
except excClass:
return
if hasattr(excClass, '__name__'):
excName = excClass.__name__
else:
excName = str(excClass)
raise self.failureException(('%s not raised' % excName))
|
'Get a detailed comparison function for the types of the two args.
Returns: A callable accepting (first, second, msg=None) that will
raise a failure exception if first != second with a useful human
readable error message for those types.'
| def _getAssertEqualityFunc(self, first, second):
| if (type(first) is type(second)):
asserter = self._type_equality_funcs.get(type(first))
if (asserter is not None):
return asserter
return self._baseAssertEqual
|
'The default assertEqual implementation, not type specific.'
| def _baseAssertEqual(self, first, second, msg=None):
| if (not (first == second)):
standardMsg = ('%s != %s' % (safe_repr(first), safe_repr(second)))
msg = self._formatMessage(msg, standardMsg)
raise self.failureException(msg)
|
'Fail if the two objects are unequal as determined by the \'==\'
operator.'
| def assertEqual(self, first, second, msg=None):
| assertion_func = self._getAssertEqualityFunc(first, second)
assertion_func(first, second, msg=msg)
|
'Fail if the two objects are equal as determined by the \'==\'
operator.'
| def assertNotEqual(self, first, second, msg=None):
| if (not (first != second)):
msg = self._formatMessage(msg, ('%s == %s' % (safe_repr(first), safe_repr(second))))
raise self.failureException(msg)
|
'Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero, or by comparing that the
between the two objects is more than the given delta.
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
If the two objects compare equal then they will automatically
compare almost equal.'
| def assertAlmostEqual(self, first, second, places=None, msg=None, delta=None):
| if (first == second):
return
if ((delta is not None) and (places is not None)):
raise TypeError('specify delta or places not both')
if (delta is not None):
if (abs((first - second)) <= delta):
return
standardMsg = ('%s != %s within %s delta' % (safe_repr(first), safe_repr(second), safe_repr(delta)))
else:
if (places is None):
places = 7
if (round(abs((second - first)), places) == 0):
return
standardMsg = ('%s != %s within %r places' % (safe_repr(first), safe_repr(second), places))
msg = self._formatMessage(msg, standardMsg)
raise self.failureException(msg)
|
'Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero, or by comparing that the
between the two objects is less than the given delta.
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
Objects that are equal automatically fail.'
| def assertNotAlmostEqual(self, first, second, places=None, msg=None, delta=None):
| if ((delta is not None) and (places is not None)):
raise TypeError('specify delta or places not both')
if (delta is not None):
if ((not (first == second)) and (abs((first - second)) > delta)):
return
standardMsg = ('%s == %s within %s delta' % (safe_repr(first), safe_repr(second), safe_repr(delta)))
else:
if (places is None):
places = 7
if ((not (first == second)) and (round(abs((second - first)), places) != 0)):
return
standardMsg = ('%s == %s within %r places' % (safe_repr(first), safe_repr(second), places))
msg = self._formatMessage(msg, standardMsg)
raise self.failureException(msg)
|
'An equality assertion for ordered sequences (like lists and tuples).
For the purposes of this function, a valid ordered sequence type is one
which can be indexed, has a length, and has an equality operator.
Args:
seq1: The first sequence to compare.
seq2: The second sequence to compare.
seq_type: The expected datatype of the sequences, or None if no
datatype should be enforced.
msg: Optional message to use on failure instead of a list of
differences.
max_diff: Maximum size off the diff, larger diffs are not shown'
| def assertSequenceEqual(self, seq1, seq2, msg=None, seq_type=None, max_diff=(80 * 8)):
| if (seq_type is not None):
seq_type_name = seq_type.__name__
if (not isinstance(seq1, seq_type)):
raise self.failureException(('First sequence is not a %s: %s' % (seq_type_name, safe_repr(seq1))))
if (not isinstance(seq2, seq_type)):
raise self.failureException(('Second sequence is not a %s: %s' % (seq_type_name, safe_repr(seq2))))
else:
seq_type_name = 'sequence'
differing = None
try:
len1 = len(seq1)
except (TypeError, NotImplementedError):
differing = ('First %s has no length. Non-sequence?' % seq_type_name)
if (differing is None):
try:
len2 = len(seq2)
except (TypeError, NotImplementedError):
differing = ('Second %s has no length. Non-sequence?' % seq_type_name)
if (differing is None):
if (seq1 == seq2):
return
seq1_repr = repr(seq1)
seq2_repr = repr(seq2)
if (len(seq1_repr) > 30):
seq1_repr = (seq1_repr[:30] + '...')
if (len(seq2_repr) > 30):
seq2_repr = (seq2_repr[:30] + '...')
elements = (seq_type_name.capitalize(), seq1_repr, seq2_repr)
differing = ('%ss differ: %s != %s\n' % elements)
for i in xrange(min(len1, len2)):
try:
item1 = seq1[i]
except (TypeError, IndexError, NotImplementedError):
differing += ('\nUnable to index element %d of first %s\n' % (i, seq_type_name))
break
try:
item2 = seq2[i]
except (TypeError, IndexError, NotImplementedError):
differing += ('\nUnable to index element %d of second %s\n' % (i, seq_type_name))
break
if (item1 != item2):
differing += ('\nFirst differing element %d:\n%s\n%s\n' % (i, item1, item2))
break
else:
if ((len1 == len2) and (seq_type is None) and (type(seq1) != type(seq2))):
return
if (len1 > len2):
differing += ('\nFirst %s contains %d additional elements.\n' % (seq_type_name, (len1 - len2)))
try:
differing += ('First extra element %d:\n%s\n' % (len2, seq1[len2]))
except (TypeError, IndexError, NotImplementedError):
differing += ('Unable to index element %d of first %s\n' % (len2, seq_type_name))
elif (len1 < len2):
differing += ('\nSecond %s contains %d additional elements.\n' % (seq_type_name, (len2 - len1)))
try:
differing += ('First extra element %d:\n%s\n' % (len1, seq2[len1]))
except (TypeError, IndexError, NotImplementedError):
differing += ('Unable to index element %d of second %s\n' % (len1, seq_type_name))
standardMsg = differing
diffMsg = ('\n' + '\n'.join(difflib.ndiff(pprint.pformat(seq1).splitlines(), pprint.pformat(seq2).splitlines())))
standardMsg = self._truncateMessage(standardMsg, diffMsg)
msg = self._formatMessage(msg, standardMsg)
self.fail(msg)
|
'A list-specific equality assertion.
Args:
list1: The first list to compare.
list2: The second list to compare.
msg: Optional message to use on failure instead of a list of
differences.'
| def assertListEqual(self, list1, list2, msg=None):
| self.assertSequenceEqual(list1, list2, msg, seq_type=list)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.