query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
The main function of the ``electrons_normalize`` module. The image given by outputfinal is converted from units of ``DN`` to ``e/s``. This is done by multiplying the image by the gain and dividing the image by the exposure time. The gain and exposure time are grabbed from the header.
def electrons_normalize(superdark): logging.info('\tConverting {} to electrons.'.format(superdark)) # Open the image and get the data hdulist = fits.open(superdark, 'update') sci1 = hdulist[1].data err2 = hdulist[2].data sci4 = hdulist[4].data err5 = hdulist[5].data # Find gains and e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def photometry(userinputs, image, catalog, outputname, apertures, annulus='', dannulus='', recenter=False):\n logging.info('Running photometry function on {}'.format(image))\n logging.info('Using {}px apertures'.format(apertures))\n\n #set directory\n target_dir = userinputs['OUTDIR']\n\n #Update pa...
[ "0.55928487", "0.54889816", "0.5454765", "0.54423666", "0.5435256", "0.5370167", "0.5334091", "0.53084034", "0.5299961", "0.527705", "0.527705", "0.52367365", "0.5215581", "0.5211756", "0.52079666", "0.5163994", "0.5149342", "0.51089543", "0.51064676", "0.5093443", "0.5086404...
0.70171016
0
Generate generic betweenagent measurement message from local measurement message.
def gen_measurement_msg(agent_id,msg): if type(msg) is list: meas_msg = [] for m in msg: new_msg = AgentMeasurement() # new_msg.type = msg._type.split('/')[1] new_msg.header.stamp = rospy.Time.now() new_msg.src = agent_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_message(self):\n meter = Meter.objects.get_or_create(name=\"4530303237303030303130313334353136\")[0]\n\n measurement = Measurement()\n measurement.meter = meter\n measurement.power_usage_current = random.randint(300,400) / 1000\n measurement.power_usage_total_low = 0...
[ "0.65161324", "0.56551564", "0.5491576", "0.5452257", "0.53777915", "0.5376039", "0.52958506", "0.5245437", "0.5220593", "0.52068007", "0.519156", "0.5148551", "0.5132906", "0.5083219", "0.50504714", "0.50471866", "0.50409704", "0.50309426", "0.5000225", "0.49718854", "0.4968...
0.6765715
0
Construct full NxN covariance matrix from flattened upper triangular elements. Useful for reconstructing covariance data from over the wire, esp. from a ROS msg.
def inflate_covariance(covariance_flat): # compute size of matrix using quadratic formula cov_size = int(-1 + np.sqrt(1 + 8*len(covariance_flat))) // 2 # get indicies for upper triangular of correct size upper_idx = np.triu_indices(cov_size) # create empty matrix for storing values inf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def covariance_matrix(self):\n\n self._order_observations()\n self.cov_matrix = self._compute_covariance_matrix(\n self.list_observations, self.list_observations)\n\n self.cov_matrix += np.diag(np.array([self.noise] * self.n_observation))\n\n return self.cov_matrix", "def c...
[ "0.6434829", "0.6285288", "0.6159606", "0.5981059", "0.5952412", "0.59400165", "0.59368193", "0.58926064", "0.58616", "0.58181053", "0.5727994", "0.5682243", "0.56566226", "0.56417537", "0.5630792", "0.5630418", "0.55739963", "0.5561916", "0.55400753", "0.5511477", "0.5502872...
0.66463983
0
Create flattened upper triangular representation of covariance. Useful for sending covariance data over the wire, esp. in a ROS msg.
def deflate_covariance(covariance): # create list of indices to grad upper triangular upper_tri_idx = np.triu_indices(covariance.shape[0]) # grab upper triangular elements from covariance using indices upper_tri_cov = covariance[upper_tri_idx] # convert array to list deflated_covariance = upp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inflate_covariance(covariance_flat):\n # compute size of matrix using quadratic formula\n cov_size = int(-1 + np.sqrt(1 + 8*len(covariance_flat))) // 2\n \n # get indicies for upper triangular of correct size\n upper_idx = np.triu_indices(cov_size)\n \n # create empty matrix for storing va...
[ "0.66811705", "0.6215715", "0.58638555", "0.5755085", "0.5676975", "0.55790585", "0.5507209", "0.55070263", "0.5482315", "0.54728806", "0.5394122", "0.53237647", "0.5302575", "0.52929914", "0.52915114", "0.52850443", "0.5271727", "0.52562267", "0.52272123", "0.5197573", "0.51...
0.62268245
1
The download directory to which the AudioFile will download itself in.
def download_dir(self) -> str: return self._download_dir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_download_dir(self):\n return self.manager.download_dir", "def _get_download_dir(self):\n return self.data['info']['root_downloads_dir']", "def get_downloads_dir():\n return _DOWNLOADS_DIR", "def download_path(self) -> str:\n return self._download_path", "def _get_default_do...
[ "0.7995271", "0.789752", "0.7642793", "0.72250736", "0.71863115", "0.6792735", "0.6771639", "0.6700152", "0.6672671", "0.666244", "0.66117615", "0.6591039", "0.6510777", "0.6510777", "0.64992404", "0.64594144", "0.6452896", "0.64474493", "0.642287", "0.64071625", "0.64017254"...
0.828115
0
The filename of the AudioFile that it will download itself to. If the filename is not explicitly set, the filename of the file on the server reachable via the self.download_url is used.
def download_filename(self) -> str: return self._download_filename
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filename(self) -> str:\n return self._filename", "def filename(self):\n if self.__filename__ is None:\n return _filename\n else:\n return self.__filename__", "def get_filename(self):\n return self.filename", "def get_filename(self):\n return se...
[ "0.77044064", "0.769287", "0.7569284", "0.7548853", "0.753745", "0.7530441", "0.75082684", "0.75082684", "0.75082684", "0.75082684", "0.74327564", "0.7406752", "0.7403629", "0.7372957", "0.73017526", "0.72556186", "0.7154353", "0.7153562", "0.71477526", "0.71476734", "0.71263...
0.810495
0
Full download path that reflects the combination of download_dir and download_filename.
def download_path(self) -> str: return self._download_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_dir(self) -> str:\n return self._download_dir", "def _get_download_dir(self):\n return self.manager.download_dir", "def _update_full_path(self):\n if self.download_dir and self.download_filename:\n self._download_path = os.path.join(self.download_dir,\n ...
[ "0.7932821", "0.7560432", "0.75391185", "0.752196", "0.7506158", "0.7304482", "0.7237244", "0.7214143", "0.7159807", "0.7148829", "0.714174", "0.710438", "0.7071977", "0.7062645", "0.7057241", "0.7057241", "0.70008653", "0.69792736", "0.69383055", "0.6750141", "0.6743837", ...
0.822728
0
Get a human readable representation of the size in bytes.
def size_str(self) -> str: return fmt_size_bytes(self._size)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_size(self):\n return u\"{} bytes\".format(self.size)", "def size(self):\n\n return str(self.size)", "def humanbytes(size):\n # https://stackoverflow.com/a/49361727/4723940\n if not size:\n return \"\"\n # 2 ** 10 = 1024\n power = 2**10\n raised_to_pow = 0\n dict_po...
[ "0.8138241", "0.8061652", "0.79895395", "0.7839657", "0.7548729", "0.7528001", "0.7491658", "0.7461993", "0.7455769", "0.7443719", "0.74179405", "0.7413462", "0.72744954", "0.72632736", "0.7252593", "0.72264695", "0.71850353", "0.7179262", "0.7177082", "0.7156043", "0.7119295...
0.86575353
0
Return if the AudioFile has been downloaded to the current download_path location.
def is_downloaded(self) -> bool: if not self.download_path: return False return Path(self.download_path).exists()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_downloaded(self):\n return self._system.file_exists(self._tar_name)", "def is_file_downloading(self, data_url):\n\n # Sometimes it takes too long to load the list\n self.parent.wait_for_element_displayed(DOM.DownloadManager.download_list[0],\n ...
[ "0.76278245", "0.7254355", "0.7206337", "0.7160229", "0.6813698", "0.67941236", "0.66685086", "0.6667035", "0.65065354", "0.63579845", "0.6348419", "0.6345613", "0.6241858", "0.6216495", "0.61943287", "0.6189139", "0.6161682", "0.6034005", "0.60187346", "0.59987867", "0.59823...
0.8001392
0
Returns a genarator of strings read from a "text_iterator" (iterating over lines), where a batch consists of adjacent lines separated by an empty line. The generator yiels one string per batch, with several adjacent lines joined by the "sep" character.
def split_batch(text_iterator, sep): current_group = [] for l in text_iterator: if l.strip() == "": if current_group: yield sep.join(current_group) current_group = [] else: current_group.append(l.strip()) yield sep.join(current_group) # las...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def txt_line_iterator(path):\n with tf.io.gfile.GFile(path) as f:\n for line in f:\n yield line.strip()", "def yield_batches(self, texts):\n batch = []\n for text in self._iter_texts(texts):\n batch.append(text)\n if len(batch) == self.batch_size:\n yie...
[ "0.5992676", "0.58370346", "0.57789314", "0.56593597", "0.56508684", "0.55819076", "0.5481003", "0.54286534", "0.54286367", "0.5426697", "0.5426456", "0.54091066", "0.53727454", "0.5350957", "0.5350398", "0.52409923", "0.52257967", "0.51570374", "0.51264596", "0.5123674", "0....
0.7925198
0
Method to obtain an image for a question
def get_image_question(self, obj): question_image = 'Sin imagen' if QuestionImage.objects.filter(question=obj).exists(): question_image = (QuestionImage.objects.filter(question=obj) .order_by('-upload_date').first()) question_image = (settings.IMAGE_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getimage(self):", "def get_image_url():", "def image(self, where):\n cook = cookie()\n I = Image(cook, self)\n self.call('image', cook, where)\n print(\"IMAGE\", where)\n return I", "def getimgs():", "def _get_image(self, name):\n document = self._control.docum...
[ "0.6956642", "0.6416805", "0.63991195", "0.6182699", "0.61808884", "0.61468655", "0.61231196", "0.6101426", "0.6090693", "0.6057402", "0.6057402", "0.6057402", "0.60554934", "0.60486346", "0.6024556", "0.6010983", "0.59846336", "0.5952543", "0.59464836", "0.5944744", "0.59110...
0.7130197
0
Method to obtain a list of tags associated of a question
def get_tags(self, obj): if QuestionTag.objects.filter(question=obj).exists(): id_tags = QuestionTag.objects.filter(question=obj).values('tag__id') tags_obj = Tag.objects.filter(id__in=id_tags) return TagSerializer(tags_obj, many=True).data else: return "N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags():", "def getTags(self,):\n\t\treturn self.tags;", "def get_all_tagged(self,tag_name):\n return self.tag2elements[tag_name]", "def dataset_tags(connection):\n assert connection\n query = \"\"\"select * from tags()\"\"\"\n result = sqlio.read_sql_query(query, connection)\n ...
[ "0.68273413", "0.6607626", "0.6580955", "0.64498675", "0.64488304", "0.6422194", "0.6385951", "0.6355473", "0.6348337", "0.63187283", "0.62957776", "0.62918216", "0.6291783", "0.6291783", "0.62898767", "0.6275979", "0.62535083", "0.6249637", "0.6228697", "0.6228697", "0.62286...
0.6970872
0
Method to obtain likes for a question
def get_likes(self, obj): return QuestionPersonLike.objects.filter(question=obj, like=True).count()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def likes(self):\r\n return Likes(self)", "def ListLikes(self, request, context):\n context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n context.set_details('Method not implemented!')\n raise NotImplementedError('Method not implemented!')", "def get_has_like(self, obj):\n if 'person_id' in ...
[ "0.6586108", "0.6507531", "0.6450978", "0.63749194", "0.6362392", "0.6258385", "0.62290895", "0.61731577", "0.60842955", "0.60090333", "0.59624845", "0.5902437", "0.5881919", "0.58568496", "0.58214945", "0.5808337", "0.58071214", "0.5805473", "0.57909113", "0.57903504", "0.57...
0.7416896
0
Method to obtain dislikes for a question
def get_dislikes(self, obj): return QuestionPersonLike.objects.filter(question=obj, like=False).count()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dislikes(self):\n return self.get_queryset().filter(vote__lt=0)", "def get_video_dislikes(self, response):\n return response.css(\".like-button-renderer-dislike-button\")\\\n .extract_first(default='')", "def test_unauthenticated_user_disliking(self):\n self.like_dislike(sel...
[ "0.73568493", "0.6755147", "0.6446478", "0.626404", "0.6240039", "0.617614", "0.6168667", "0.6094948", "0.6049946", "0.601232", "0.59809875", "0.5943443", "0.5925991", "0.59026235", "0.58979905", "0.5856151", "0.5781004", "0.57581604", "0.5747891", "0.5728713", "0.56589115", ...
0.761897
0
Return the name used in the html form for the given form instance and field name.
def get_html_name(form, name): return form.add_prefix(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_field_name(self, instance):\n fields = getattr(instance, \"_fields\")\n return fields[self.id]", "def form_name(self):\n \n # Unpack\n request = self.request\n context = request.context\n \n # Prepare\n first_btn = len(self.buttons) and self...
[ "0.7348436", "0.71176386", "0.6880881", "0.685868", "0.6820191", "0.6801114", "0.6696409", "0.66775125", "0.65721667", "0.6490497", "0.6363262", "0.6351724", "0.6348922", "0.6331888", "0.6311538", "0.63034886", "0.6261783", "0.62236905", "0.62060416", "0.61982995", "0.6181344...
0.7297755
1
For the given named field, get the attrs as determined by the field and widget settings.
def get_format_attrs(self, name, field, alt_field_info={}): # important_props = ('initial', 'autofocus', 'widget') if name in alt_field_info: field = deepcopy(field) for prop, value in alt_field_info[name].items(): setattr(field, prop, value) initial = fie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_field_attributes(self, fieldname):\n return self.read_field(fieldname).attributes", "def get_field_attr(name):\n # de variant met een repeating group (entiteit, dataitem) levert hier nog een probleem op.\n # is dat omdat er twee entiteiten in 1 scherm staan?\n fields = []\n opts = my....
[ "0.66450113", "0.59228253", "0.5825731", "0.5723031", "0.56653965", "0.5607219", "0.5606834", "0.56044406", "0.5507906", "0.54786855", "0.54504424", "0.54347646", "0.5379743", "0.5346478", "0.5339721", "0.53374994", "0.53265065", "0.5322189", "0.53207207", "0.531892", "0.5298...
0.64204663
1
Used for constructing expected format for field & top errors for FormFieldsetMixIn or default html.
def error_format(self, as_type, error, **kwargs): error = str(error) multi_field_row, txt, attr = None, '', '' errors_own_row = kwargs.get('errors_on_separate_row', None) errors_own_row = True if as_type == 'as_p' and errors_own_row is None else errors_own_row context = 'default_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_expected_format(self, setup):\n form = setup.pop('form', self.form)\n as_type = setup['as_type']\n setup.update(attrs='')\n alt_field_info = {}\n if issubclass(self.form_class, FormOverrideMixIn):\n size_default = form.get_overrides().get('_default_', {}).get('...
[ "0.67704564", "0.6728421", "0.66664016", "0.66186965", "0.65348", "0.64916956", "0.62855846", "0.6223227", "0.6135441", "0.6113346", "0.607899", "0.6025238", "0.59972215", "0.5962001", "0.5957512", "0.59342605", "0.5921345", "0.5884591", "0.57812124", "0.57583904", "0.5756056...
0.732005
0
Confirm the expected user_type was made, using the expected mock or actual user model setup.
def test_made_user(self, user=None): user_attr = dict(is_active=True, is_authenticated=True, is_anonymous=False, is_staff=False, is_superuser=False) attr_by_type = { 'anonymous': {'is_active': False, 'is_authenticated': False, 'is_anonymous': True}, 'superuser': {'is_staff': True...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_instance(self):\n self.assertIsInstance(self.new_user, User)", "def test_types(self):\n user = User()\n self.assertEqual(type(user.email), str)\n self.assertEqual(type(user.password), str)\n self.assertEqual(type(user.first_name), str)\n self.assertEqual(ty...
[ "0.6708035", "0.6635206", "0.66030097", "0.65733236", "0.64285797", "0.62816226", "0.6239699", "0.6232441", "0.622803", "0.62261146", "0.61945903", "0.61739534", "0.612075", "0.61204076", "0.6098736", "0.60581166", "0.6035631", "0.5991678", "0.5978381", "0.59691936", "0.59606...
0.72495323
0
All forms should return HTML table rows when .as_table is called.
def test_as_table(self, output=None, form=None): setup = {'start_tag': '<tr><th>', 'label_end': '</th><td>', 'input_end': '<br>', 'end_tag': '</td></tr>'} setup['as_type'] = as_type = 'as_table' setup['form'] = form or self.form output = output or setup['form'].as_table().strip() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_as_table(form):\n return {'form': form}", "def _repr_html_(self):\n return html_table(self)", "def as_table(self, field_name=None):\r\n if field_name is None:\r\n normal_row = u'<tr><th>%(label)s</th><td>%(errors)s%(field)s' \\\r\n u'%(help_text)s...
[ "0.7701475", "0.66434586", "0.66034126", "0.64598995", "0.64371777", "0.6176933", "0.6121198", "0.605766", "0.60159713", "0.5942964", "0.5915406", "0.58860743", "0.5879036", "0.5878051", "0.5855618", "0.5853942", "0.5805384", "0.57895756", "0.57610744", "0.57559323", "0.57558...
0.68445253
1
All forms should return HTML s when .as_ul is called.
def test_as_ul(self, output=None, form=None): setup = {'start_tag': '<li>', 'end_tag': '</li>', 'label_end': ' ', 'input_end': ' '} setup['as_type'] = as_type = 'as_ul' setup['form'] = form or self.form output = output or setup['form'].as_ul().strip() expected = self.get_expected...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_form_content(self):\n return mark_safe(self.render_as_object() + self.render_missing_fields())", "def render_form():", "def render_form(self):\n s = [f.render() for f in self.fields]\n r = [f.render() for f in self.refs]\n return view.render_form('form.html', {\n ...
[ "0.6513047", "0.6463842", "0.6252335", "0.5958505", "0.59378386", "0.59344834", "0.58983976", "0.5804516", "0.577028", "0.574896", "0.57450455", "0.57045156", "0.5641969", "0.56327015", "0.56324124", "0.562148", "0.56147474", "0.5611882", "0.5600873", "0.5544296", "0.54834974...
0.6899708
0
All forms should return HTML s when .as_p is called.
def test_as_p(self, output=None, form=None): setup = {'start_tag': '<p>', 'end_tag': '</p>', 'label_end': ' ', 'input_end': ' '} setup['as_type'] = as_type = 'as_p' setup['form'] = form or self.form output = output or setup['form'].as_p().strip() expected = self.get_expected_form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_form_content(self):\n return mark_safe(self.render_as_object() + self.render_missing_fields())", "def render_form():", "def __html__(self):\n return self.html", "def toFormMarkup(self, form_tag_attrs=None):\n return self.fields.toFormMarkup(\n self.request.retur...
[ "0.6810297", "0.6472013", "0.6343937", "0.62592846", "0.62355494", "0.61389494", "0.61310256", "0.60670376", "0.60670376", "0.6013662", "0.59986526", "0.5965411", "0.5965411", "0.592587", "0.5887663", "0.5844421", "0.5843759", "0.5825722", "0.5807929", "0.5801746", "0.5789513...
0.6754369
1
Returns a list of all fields that have been given an HTML attribute of 'autofocus'.
def find_focus_field(self): fields = self.get_current_fields() found_names = [] for field_name, field in fields.items(): has_focus = field.widget.attrs.get('autofocus', None) if has_focus: found_names.append(field_name) return found_names
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_focus_on_limited_fields(self):\n original_named_focus = self.form.named_focus\n original_fields_focus = self.form.fields_focus\n original_given_focus = self.form.given_focus\n original_fields = self.form.fields\n self.form.named_focus = None\n self.form.given_focu...
[ "0.52875453", "0.5232824", "0.5178835", "0.5138746", "0.5121877", "0.5111444", "0.499848", "0.49805778", "0.49702394", "0.4962316", "0.49381164", "0.49381164", "0.49381164", "0.49381164", "0.48813406", "0.48727515", "0.48725775", "0.4858869", "0.48553702", "0.48552412", "0.48...
0.760456
0
Always True if the assign_focus_field method is absent. Otherwise checks if configured properly.
def test_focus(self, name=None): focus_func = getattr(self.form, 'assign_focus_field', None) fields = self.get_current_fields() if focus_func and issubclass(self.__class__, FocusMixIn): name = name or getattr(self.form, 'named_focus', None) expected = focus_func(name, fie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_focus_not_on_disabled(self):\n target = 'disable_field'\n field = self.form.fields.get(target, None)\n result_name = self.form.assign_focus_field(target)\n focused = self.find_focus_field()\n\n self.assertTrue(field.disabled)\n self.assertIn(target, self.form.fiel...
[ "0.6225829", "0.6135285", "0.6015267", "0.5842026", "0.5791978", "0.570093", "0.5611743", "0.55692565", "0.54178447", "0.5409445", "0.5406703", "0.53621715", "0.5328423", "0.5315723", "0.5312581", "0.5309278", "0.52890605", "0.5272042", "0.52682996", "0.51996136", "0.5184624"...
0.6568815
0
The prep_remaining method exists. Unchanged, it returns parameters unmodified.
def test_prep_remaining(self): self.assertTrue(hasattr(self.form, 'prep_remaining')) original_fields = self.form.fields self.form.fields = original_fields.copy() remaining_fields = original_fields.copy() opts, field_rows = {'fake_opts': 'fake', 'fields': ['nope']}, [{'name': 'ass...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_forward(self, *args, **kwargs):\n self.allocate_parameter()\n return args, kwargs", "def _prepare_args(local_vars):\n return {k: v for k, v in local_vars.items() if k != 'self'}", "def pre_forward(self, *args, **kwargs):\n batch_size = args[0].shape[0]\n if not self.i...
[ "0.61176014", "0.54957813", "0.53316176", "0.5303457", "0.52536845", "0.51523024", "0.51523024", "0.51110625", "0.5101072", "0.50850767", "0.5084306", "0.5054285", "0.5016299", "0.49983084", "0.49983084", "0.49926323", "0.49725908", "0.4972565", "0.49686494", "0.49686494", "0...
0.6892399
0
When all columns have an error, returns a list of HTML for each error from the get_error_data method.
def test_get_error_data_all_col_errors(self): field_setup = None error_names = None prepared_info = self.setup_error_data(field_setup, error_names) for row in prepared_info: self.assertEqual(row['expected'], row['actual'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multi_col_error_format(self, as_type, errors, **kwargs):\n error_data = [self.error_format(as_type, error, **kwargs) for error in errors]\n row_tag = 'tr' if as_type == 'as_table' else 'li' if as_type == 'ul' else 'p'\n row_tag = kwargs.get('row_tag', row_tag)\n error_row = self.for...
[ "0.6514373", "0.63945425", "0.633298", "0.6190096", "0.615535", "0.6126942", "0.6110843", "0.604707", "0.59112227", "0.58642846", "0.5820168", "0.5799477", "0.5793237", "0.572578", "0.56842726", "0.56616896", "0.56543785", "0.5636649", "0.56153303", "0.56017125", "0.5576056",...
0.64467424
1
For as_table, but no errors, returns an empty list from the get_error_data method.
def test_get_error_data_table_when_no_errors(self): field_setup = None error_names = ['non-field_name', 'not_a_field'] prepared_info = self.setup_error_data(field_setup, error_names, True) for row in prepared_info: self.assertEqual(row['expected'], row['actual'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fail_table(self):\n return self._table(self.missing())", "def check_table(self):\n self.missing()\n return self._table(self._data_list)", "def get_errors(self):\n df = self.get_events()\n return df[df.error.notnull()]", "def getErrorTable(self, *args):\n return _...
[ "0.72233516", "0.7046056", "0.68150246", "0.66112614", "0.65986466", "0.6566071", "0.6397619", "0.63746923", "0.6374066", "0.63721627", "0.63696045", "0.62999004", "0.62786764", "0.6249668", "0.6141945", "0.61023694", "0.60779744", "0.60368246", "0.6036796", "0.6036796", "0.5...
0.70959044
1
The determine_label_width method returns empty values if there are not multiple rows of a single field.
def test_label_width_not_enough_single_field_rows(self): name, *names = list(self.form.fields.keys()) field_rows = [{name: self.form.fields[name]}] if len(names) > 1: double_row = {name: self.form.fields[name] for name in names[:2]} field_rows.append(double_row) e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_determine_label_width(self):\n original_setting = self.form.adjust_label_width\n self.form.adjust_label_width = True\n allowed_fields = self.get_allowed_width_fields()\n test_fields = allowed_fields.copy() # TODO: ? Try an input with some double and some single column rows?\n ...
[ "0.7584676", "0.7144227", "0.69959676", "0.6753862", "0.6716436", "0.6588278", "0.62719077", "0.59885305", "0.59496754", "0.59277505", "0.590034", "0.58805966", "0.5765796", "0.5680677", "0.56574476", "0.5654118", "0.56539017", "0.5639267", "0.5634049", "0.55727243", "0.55719...
0.76836616
0
Returns a dict of fields that are allowed to have a label_width with the current Form settings.
def get_allowed_width_fields(self, fields=None): fields = fields or self.form.fields allowed_fields = {} for name, field in fields.items(): if isinstance(field.widget, self.form.label_width_widgets): if not isinstance(field.widget, self.form.label_exclude_widgets): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_determine_label_width(self):\n original_setting = self.form.adjust_label_width\n self.form.adjust_label_width = True\n allowed_fields = self.get_allowed_width_fields()\n test_fields = allowed_fields.copy() # TODO: ? Try an input with some double and some single column rows?\n ...
[ "0.6926243", "0.67922205", "0.65030986", "0.6348227", "0.62569344", "0.62152576", "0.60450655", "0.5798008", "0.5680771", "0.56420004", "0.5495756", "0.54944915", "0.5481224", "0.5414982", "0.53760886", "0.5371737", "0.53142047", "0.5259465", "0.5247573", "0.5178113", "0.5174...
0.8165431
0
If all excluded based on accepted & rejected widgets, determine_label_width method returns empty values.
def test_only_correct_widget_classes(self): original_setting = self.form.adjust_label_width self.form.adjust_label_width = True allowed = self.get_allowed_width_fields() reject_fields = {name: field for name, field in self.form.fields.items() if name not in allowed} expected = {}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_determine_label_width(self):\n original_setting = self.form.adjust_label_width\n self.form.adjust_label_width = True\n allowed_fields = self.get_allowed_width_fields()\n test_fields = allowed_fields.copy() # TODO: ? Try an input with some double and some single column rows?\n ...
[ "0.6900942", "0.6662642", "0.6632147", "0.65091807", "0.63519573", "0.6130144", "0.59320104", "0.5691575", "0.56476486", "0.5532103", "0.5417186", "0.53969026", "0.5254832", "0.5161755", "0.51483375", "0.51461124", "0.51221085", "0.5091557", "0.5088456", "0.5035986", "0.50245...
0.74192923
0
The determine_label_width method raises ImproperlyConfigured if the computed width is greater than max.
def test_raises_too_wide_label_width(self): original_max = self.form.max_label_width original_setting = self.form.adjust_label_width self.form.adjust_label_width = True max_width = 2 self.form.max_label_width = max_width allowed_fields = self.get_allowed_width_fields() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_determine_label_width(self):\n original_setting = self.form.adjust_label_width\n self.form.adjust_label_width = True\n allowed_fields = self.get_allowed_width_fields()\n test_fields = allowed_fields.copy() # TODO: ? Try an input with some double and some single column rows?\n ...
[ "0.73650086", "0.7321378", "0.7114164", "0.70857173", "0.69556487", "0.6784753", "0.6699411", "0.6364969", "0.6299058", "0.6297865", "0.62883717", "0.6205101", "0.61536425", "0.6092609", "0.6080728", "0.6022229", "0.6009686", "0.5990843", "0.5984443", "0.5941904", "0.5913759"...
0.8070989
0
The determine_label_width method sets width based on word length if full label would exceed the max.
def test_word_wrap_label_width(self): original_max = self.form.max_label_width original_setting = self.form.adjust_label_width self.form.adjust_label_width = True allowed_fields = self.get_allowed_width_fields() labels = [field.label or pretty_name(name) for name, field in allowe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_label_width_fits_full_label_if_small_enough(self):\n original_max = self.form.max_label_width\n original_setting = self.form.adjust_label_width\n self.form.adjust_label_width = True\n allowed_fields = self.get_allowed_width_fields()\n labels = [field.label or pretty_name...
[ "0.76109344", "0.74859214", "0.7330534", "0.7205037", "0.714588", "0.7096384", "0.6610137", "0.64905024", "0.6397106", "0.6115807", "0.60559005", "0.6041587", "0.5970336", "0.57739186", "0.5753549", "0.57334375", "0.5718662", "0.57057786", "0.56782657", "0.56764853", "0.56514...
0.7630568
0
Happy path for determine_label_width method returns inline style attribute and list of field names.
def test_determine_label_width(self): original_setting = self.form.adjust_label_width self.form.adjust_label_width = True allowed_fields = self.get_allowed_width_fields() test_fields = allowed_fields.copy() # TODO: ? Try an input with some double and some single column rows? lab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label_width(self):\n return self._label_width", "def test_word_wrap_label_width(self):\n original_max = self.form.max_label_width\n original_setting = self.form.adjust_label_width\n self.form.adjust_label_width = True\n allowed_fields = self.get_allowed_width_fields()\n ...
[ "0.66162574", "0.63157785", "0.62884843", "0.6097747", "0.6095963", "0.609009", "0.599724", "0.5800857", "0.5790533", "0.5693854", "0.5683141", "0.5627819", "0.5627223", "0.5559427", "0.5513676", "0.54520077", "0.54327476", "0.53836983", "0.5382971", "0.53284246", "0.53239447...
0.71076655
0
The make_fieldsets method calls the prep_fields method (usually from FormOverrideMixIn) if it is present.
def test_make_fieldsets_uses_prep_fields(self): original_called_prep_fields = self.form.called_prep_fields = False full_fieldsets = self.form.make_fieldsets() self.assertFalse(original_called_prep_fields) self.assertIsInstance(full_fieldsets, (list, tuple)) self.assertIsNotNone(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_overall_make_fieldsets(self):\n original_fieldsets = self.form.fieldsets\n self.form.fieldsets = (\n ('Your Name', {\n 'position': 1,\n 'fields': [('first_name', 'last_name', )],\n }),\n (None, {\n 'classes': ('cou...
[ "0.7192431", "0.67726475", "0.6687887", "0.6674191", "0.64705116", "0.64192563", "0.6232401", "0.5865996", "0.581735", "0.5797246", "0.5771073", "0.5763768", "0.5759727", "0.56897867", "0.5605286", "0.5578745", "0.555899", "0.55580986", "0.55485183", "0.5542049", "0.553905", ...
0.79475874
0
The make_fieldsets method raises ImproperlyConfigured if initial fieldset is missing fields or position.
def test_raises_if_initial_fieldsets_error(self): original_fieldsets = self.form.fieldsets test_fieldsets = ( ('Your Name', { 'position': 1, 'fields': [('first_name', 'last_name', )], }), (None, { 'classes': ('counting',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_missing_initial_fieldsets(self):\n original_initial_fieldsets = self.form.fieldsets\n print(\"========================= TEST UNABLE TO DELETE THE PROPERTY FOR TESTING ========================\")\n print(original_initial_fieldsets)\n print(\"-------------------------------------...
[ "0.7113292", "0.7038173", "0.6950497", "0.6687227", "0.6648511", "0.6438534", "0.62719536", "0.62524635", "0.62194395", "0.57437134", "0.5563694", "0.55427533", "0.54819524", "0.54546463", "0.54445684", "0.5434063", "0.5427221", "0.54245543", "0.53959405", "0.5385944", "0.535...
0.77119344
0
The make_fieldsets method recognizes field name in opts['fields'] if coded with leading underscore.
def test_make_fieldsets_names_can_be_coded(self): original_fieldsets = self.form.fieldsets test_fieldsets = ( (None, { 'position': 1, 'fields': [ ('first', 'second', ), ('_name_for_coded', 'last', ), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_overall_make_fieldsets(self):\n original_fieldsets = self.form.fieldsets\n self.form.fieldsets = (\n ('Your Name', {\n 'position': 1,\n 'fields': [('first_name', 'last_name', )],\n }),\n (None, {\n 'classes': ('cou...
[ "0.5953393", "0.5751381", "0.54727715", "0.5424251", "0.53929144", "0.5327848", "0.5306404", "0.5271056", "0.52634686", "0.5145739", "0.5141719", "0.5112773", "0.5019852", "0.49609268", "0.49462354", "0.49419573", "0.49116835", "0.48910275", "0.48370573", "0.4824321", "0.4810...
0.6066722
0
The make_fieldsets appends the top_errors with any errors found for hidden fields.
def test_top_errors_has_hidden_field_errors(self): original_errors = getattr(self.form, '_errors', None) original_cleaned_data = getattr(self.form, 'cleaned_data', None) self.form._errors = ErrorDict() self.form.cleaned_data = {} name = 'hide_field' test_error = "This is ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_top_errors_at_top_html(self):\n original_errors = getattr(self.form, '_errors', None)\n original_cleaned_data = getattr(self.form, 'cleaned_data', None)\n self.form._errors = ErrorDict()\n self.form.cleaned_data = {}\n test_error = \"This non-field error is placed here j...
[ "0.6465135", "0.6115833", "0.59661514", "0.5934159", "0.58572865", "0.58312654", "0.566221", "0.558073", "0.5526183", "0.5521391", "0.54735476", "0.54313666", "0.54068094", "0.540523", "0.53880537", "0.53808004", "0.5351047", "0.5336266", "0.5306288", "0.530005", "0.52970535"...
0.75544244
0
The make_fieldsets method calls the handle_modifiers method (from FormOverrideMixIn) if it is present.
def test_make_fieldsets_uses_handle_modifiers(self): original_called_handle_modifiers = self.form.called_handle_modifiers = False full_fieldsets = self.form.make_fieldsets() self.assertFalse(original_called_handle_modifiers) self.assertIsInstance(full_fieldsets, (list, tuple)) s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_handle_modifiers(self):\n # FormOverrideMixIn.handle_modifiers\n pass", "def test_overall_make_fieldsets(self):\n original_fieldsets = self.form.fieldsets\n self.form.fieldsets = (\n ('Your Name', {\n 'position': 1,\n 'fields': [('firs...
[ "0.64318436", "0.63963795", "0.6121364", "0.60134304", "0.5967845", "0.58336", "0.57580954", "0.57000554", "0.5655005", "0.55753636", "0.55143034", "0.5351658", "0.53252023", "0.5285269", "0.52683055", "0.5224833", "0.5220986", "0.5168513", "0.51611114", "0.5140313", "0.51210...
0.8040682
0
The make_fieldsets method saves the computed fieldsets to form._fieldsets, and saves a form._fs_summary.
def test_make_fieldsets_saves_results(self): original_initial_fieldsets = getattr(self.form, 'fieldsets', None) initial_fieldsets = deepcopy(original_initial_fieldsets) original_computed_fieldsets = getattr(self.form, '_fieldsets', None) original_summary = getattr(self.form, '_fs_summary...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_overall_make_fieldsets(self):\n original_fieldsets = self.form.fieldsets\n self.form.fieldsets = (\n ('Your Name', {\n 'position': 1,\n 'fields': [('first_name', 'last_name', )],\n }),\n (None, {\n 'classes': ('cou...
[ "0.6202503", "0.5993465", "0.59412736", "0.58321846", "0.5802802", "0.57773435", "0.5747591", "0.5710147", "0.5673536", "0.5596267", "0.5425132", "0.5367448", "0.5340725", "0.5300301", "0.5291684", "0.52537316", "0.5224285", "0.5199588", "0.51841486", "0.5142671", "0.5112501"...
0.7419774
0
If initial fieldsets is not defined, warning is raised.
def test_missing_initial_fieldsets(self): original_initial_fieldsets = self.form.fieldsets print("========================= TEST UNABLE TO DELETE THE PROPERTY FOR TESTING ========================") print(original_initial_fieldsets) print("--------------------------------------") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_raises_if_initial_fieldsets_error(self):\n original_fieldsets = self.form.fieldsets\n test_fieldsets = (\n ('Your Name', {\n 'position': 1,\n 'fields': [('first_name', 'last_name', )],\n }),\n (None, {\n 'classes':...
[ "0.77882177", "0.6555793", "0.6518415", "0.63593554", "0.6162676", "0.6096139", "0.608212", "0.59703225", "0.59213835", "0.5915669", "0.5915668", "0.5871524", "0.58497983", "0.578148", "0.5659497", "0.56561965", "0.56023", "0.55925554", "0.5584792", "0.5581815", "0.55792415",...
0.73718363
1
Any empty rows defined in the initial fieldset settings are removed in the computed fieldset settings.
def test_no_empty_rows_in_computed_fieldsets(self): original_fieldsets = self.form.fieldsets self.form.fieldsets = ( ('Your Name', { 'position': 1, 'fields': [('first_name', 'last_name', )], }), (None, { 'classes': ('cou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self):\n\t\tself.beginRemoveRows(QModelIndex(), 0, len(self.fields))\n\t\tself.fields = []\n\t\tself.endRemoveRows()", "def test_no_empty_sets_in_computed_fieldsets(self):\n original_fieldsets = self.form.fieldsets\n self.form.fieldsets = (\n ('Your Name', {\n 'p...
[ "0.66703916", "0.66108024", "0.6571478", "0.65662205", "0.64384866", "0.622195", "0.6153714", "0.61123395", "0.6112054", "0.6008037", "0.5997267", "0.5988325", "0.59726787", "0.59608305", "0.59185666", "0.59006476", "0.58773136", "0.5838165", "0.5829497", "0.58233345", "0.582...
0.69864285
0
Any empty fieldset defined in initial fieldset settings are removed in the computed fieldset settings.
def test_no_empty_sets_in_computed_fieldsets(self): original_fieldsets = self.form.fieldsets self.form.fieldsets = ( ('Your Name', { 'position': 1, 'fields': [('first_name', 'last_name', )], }), ('Non_Fields', { 'positio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_missing_initial_fieldsets(self):\n original_initial_fieldsets = self.form.fieldsets\n print(\"========================= TEST UNABLE TO DELETE THE PROPERTY FOR TESTING ========================\")\n print(original_initial_fieldsets)\n print(\"-------------------------------------...
[ "0.6889715", "0.6360244", "0.6088527", "0.59613407", "0.59489715", "0.59358686", "0.5868241", "0.5843636", "0.5843636", "0.5824178", "0.5816966", "0.57959515", "0.5762446", "0.57576734", "0.57333314", "0.57224417", "0.57116276", "0.5707388", "0.57031906", "0.56946254", "0.568...
0.67204076
1
The each fieldset in the computed fieldset settings have all the expected keys in their options.
def test_computed_fieldsets_structure(self): original_fieldsets = self.form.fieldsets self.form.fieldsets = ( ('Your Name', { 'position': 1, 'fields': [('first_name', 'last_name', )], }), (None, { 'classes': ('counting',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_empty_sets_in_computed_fieldsets(self):\n original_fieldsets = self.form.fieldsets\n self.form.fieldsets = (\n ('Your Name', {\n 'position': 1,\n 'fields': [('first_name', 'last_name', )],\n }),\n ('Non_Fields', {\n ...
[ "0.641561", "0.6393425", "0.6136707", "0.6101192", "0.5897014", "0.58947396", "0.5781593", "0.5745731", "0.573621", "0.56874764", "0.5633608", "0.5565005", "0.5522902", "0.551594", "0.5493446", "0.54890853", "0.5461729", "0.5406058", "0.5404863", "0.54012376", "0.5399749", ...
0.68545306
0
The make_fieldsets method assigns and sorts according to the expected order.
def test_make_fieldsets_outcome_order(self): original_fieldsets = self.form.fieldsets self.form.fieldsets = ( (None, { 'classes': ('counting', ), 'position': 2, 'fields': [ ('first', 'second', ), 'last', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_make_fieldsets_uses_prep_fields(self):\n original_called_prep_fields = self.form.called_prep_fields = False\n full_fieldsets = self.form.make_fieldsets()\n\n self.assertFalse(original_called_prep_fields)\n self.assertIsInstance(full_fieldsets, (list, tuple))\n self.asser...
[ "0.6534397", "0.6528733", "0.63007706", "0.5835942", "0.573928", "0.5678768", "0.56393546", "0.563493", "0.5626828", "0.55249393", "0.55195516", "0.5459207", "0.5449235", "0.5386196", "0.53837943", "0.5338345", "0.52496123", "0.5248201", "0.5243698", "0.5192275", "0.5124239",...
0.69416034
0
The make_fieldsets method returns the expected response.
def test_overall_make_fieldsets(self): original_fieldsets = self.form.fieldsets self.form.fieldsets = ( ('Your Name', { 'position': 1, 'fields': [('first_name', 'last_name', )], }), (None, { 'classes': ('counting', ), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_make_fieldsets_saves_results(self):\n original_initial_fieldsets = getattr(self.form, 'fieldsets', None)\n initial_fieldsets = deepcopy(original_initial_fieldsets)\n original_computed_fieldsets = getattr(self.form, '_fieldsets', None)\n original_summary = getattr(self.form, '_f...
[ "0.71624404", "0.61265737", "0.6096746", "0.60655487", "0.6024743", "0.59263253", "0.59168625", "0.5904047", "0.58811647", "0.58270705", "0.58269846", "0.563818", "0.5591763", "0.55192465", "0.53909874", "0.53210807", "0.5267671", "0.5244225", "0.521522", "0.5199726", "0.5155...
0.61366403
1
The column_formats method returns the column and single_column strings with formatting placeholders.
def test_column_formats(self): attrs = '%(html_col_attr)s' col_tag = 'span' single_col_tag = '' col_data = '%(errors)s%(label)s %(field)s%(help_text)s' expected_col = self.form._html_tag(col_tag, col_data, attrs) expected_single = col_data if not single_col_tag else self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_column_formats(self):\n image_columns = self.image_column_nums()\n formats = [self.column_formats[i] if i not in image_columns else '%h' for i in range(len(self.column_formats))]\n return formats[1:-2]", "def format_column(self, column, use_table=False, name=None, table_name=None):\n...
[ "0.6807568", "0.6566808", "0.63878995", "0.6377883", "0.6346472", "0.6292111", "0.62664866", "0.62439483", "0.6219398", "0.60932344", "0.5966978", "0.58984876", "0.58768934", "0.5819751", "0.57350343", "0.57184577", "0.5713034", "0.5690501", "0.5494927", "0.545833", "0.545673...
0.7047156
0
The column_formats method, when col_head_tag is present, returns the expected response.
def test_column_formats_col_head_tag(self): col_head_tag = 'th' col_tag = 'td' single_col_tag = col_tag col_head_data = '%(label)s' col_data = '%(errors)s%(field)s%(help_text)s' head_html = self.form._html_tag(col_head_tag, col_head_data, '%(html_head_attr)s') bas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_column_formats(self):\n attrs = '%(html_col_attr)s'\n col_tag = 'span'\n single_col_tag = ''\n col_data = '%(errors)s%(label)s %(field)s%(help_text)s'\n expected_col = self.form._html_tag(col_tag, col_data, attrs)\n expected_single = col_data if not single_col_tag...
[ "0.7332766", "0.6072905", "0.6048208", "0.5892109", "0.58095014", "0.5799792", "0.5785104", "0.5629377", "0.55766165", "0.5543907", "0.5543907", "0.5517988", "0.5467961", "0.5380816", "0.5371949", "0.53589845", "0.5341816", "0.52791214", "0.52547175", "0.5219514", "0.52178514...
0.78356194
0
The collect_columns method applies the multi_field_row_class to HTML attributes on columns.
def test_css_class_for_multi_field_row_columns(self): # form._html_output(self, row_tag, col_head_tag, col_tag, single_col_tag, col_head_data, col_data, # help_text_br, errors_on_separate_row, as_type=None, strict_columns=False) # css_classes = ' '.join(['nowrap', css_classes])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_collected_columns_as_table_one_col_from_many(self):\n col_double, allow_colspan = True, True # as_type == 'table'\n col_args = ('span', False, {})\n name, multi_field_row = 'first', False\n names = [name]\n row = {name: self.form.fields[name]}\n col_count = 3\n ...
[ "0.55407095", "0.52808714", "0.5144478", "0.51113474", "0.5090835", "0.5089068", "0.50605047", "0.5045822", "0.50412333", "0.49674788", "0.49350232", "0.49150926", "0.49048653", "0.49031234", "0.48734918", "0.48659092", "0.48523653", "0.48229092", "0.48038903", "0.4799636", "...
0.74624133
0
The FormFieldsetMixIn new _html_output method will call assign_focus_field method if present.
def test_html_output_formfieldset_use_focus_if_present(self): original_focus_called = self.form.called_assign_focus_field for as_type in ('as_p', 'as_ul', 'as_table', 'as_fieldset'): self.form.called_assign_focus_field = False html_output = getattr(self.form, as_type)() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_html_output_default_use_focus_if_present(self):\n original_focus_called = self.form.called_assign_focus_field\n for as_type in ('as_p', 'as_ul', 'as_table'):\n self.form.called_assign_focus_field = False\n html_output = getattr(self.form, as_type + '_old')()\n ...
[ "0.7107614", "0.56360286", "0.53862023", "0.53715336", "0.51885885", "0.5155153", "0.5140702", "0.5073164", "0.5016641", "0.50019234", "0.49776796", "0.49149355", "0.4902441", "0.49001548", "0.48874465", "0.4879166", "0.4837746", "0.48375157", "0.47979036", "0.47805056", "0.4...
0.77101827
0
The default _html_output method will call assign_focus_field method if present.
def test_html_output_default_use_focus_if_present(self): original_focus_called = self.form.called_assign_focus_field for as_type in ('as_p', 'as_ul', 'as_table'): self.form.called_assign_focus_field = False html_output = getattr(self.form, as_type + '_old')() message ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_html_output_formfieldset_use_focus_if_present(self):\n original_focus_called = self.form.called_assign_focus_field\n for as_type in ('as_p', 'as_ul', 'as_table', 'as_fieldset'):\n self.form.called_assign_focus_field = False\n html_output = getattr(self.form, as_type)()\...
[ "0.70727175", "0.5861443", "0.5413612", "0.52534735", "0.5232743", "0.5035901", "0.5027788", "0.4992459", "0.49813837", "0.49795794", "0.4854642", "0.4845558", "0.48208484", "0.48208484", "0.48208484", "0.48208484", "0.48208484", "0.48208484", "0.47939968", "0.4782367", "0.47...
0.7255053
0
For as_type='table', regardless of other settings, the 'determine_label_width' method is not called.
def test_html_output_label_attrs_table(self): self.label_calls = [] def fake_label_width(rows): self.label_calls.append(rows); return {} original_adjust_label_width = self.form.adjust_label_width self.form.adjust_label_width = True original_label_method = self.form.determine_labe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_determine_label_width(self):\n original_setting = self.form.adjust_label_width\n self.form.adjust_label_width = True\n allowed_fields = self.get_allowed_width_fields()\n test_fields = allowed_fields.copy() # TODO: ? Try an input with some double and some single column rows?\n ...
[ "0.7241686", "0.64997905", "0.64593494", "0.64277035", "0.63348335", "0.62912124", "0.62319434", "0.61944085", "0.6070183", "0.5979112", "0.5969667", "0.58039486", "0.57957506", "0.56060773", "0.5570745", "0.5514113", "0.5506302", "0.5504249", "0.5498929", "0.5462957", "0.542...
0.69940203
1
The FormFieldsetMixIn new _html_output method mimics the default behavior for including top_errors.
def test_top_errors_at_top_html(self): original_errors = getattr(self.form, '_errors', None) original_cleaned_data = getattr(self.form, 'cleaned_data', None) self.form._errors = ErrorDict() self.form.cleaned_data = {} test_error = "This non-field error is placed here just to pick...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_bootstrap(self):\n top_errors = self.non_field_errors() # Errors that should be displayed above all fields.\n output, hidden_fields = [], []\n normal_row = u'<div%(html_class_attr)s>%(label)s<div class=\"controls\">%(field)s%(help_text)s</div>%(errors)s</div>'\n boolean_row = u'...
[ "0.66065264", "0.6020077", "0.598511", "0.5979558", "0.5977636", "0.5950189", "0.58260643", "0.5744498", "0.5719048", "0.5718157", "0.5701717", "0.5622944", "0.5612383", "0.5560728", "0.55581754", "0.55074865", "0.54561716", "0.54443824", "0.54206306", "0.5382315", "0.5365857...
0.7641828
0
When there are no errors, and only hidden fields, the form should still include the hidden fields.
def test_when_only_hidden_fields(self): original_fields = self.form.fields test_fields = deepcopy(original_fields) test_fields = {name: field for name, field in test_fields.items() if isinstance(field, CharField)} for name, field in test_fields.items(): widget = field.hidden_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_make_form_hidden():", "def form_Hidden(request):\n schema = schemaish.Structure()\n schema.add('Visible', schemaish.String())\n schema.add('Hidden', schemaish.String())\n\n form = formish.Form(schema, 'form')\n form['Hidden'].widget = formish.Hidden()\n return form", "def test_top_er...
[ "0.68661916", "0.6811355", "0.67987543", "0.6677568", "0.64834374", "0.6395069", "0.6395069", "0.6357457", "0.6294517", "0.6206772", "0.61329913", "0.60750717", "0.60695505", "0.60664195", "0.60267085", "0.59971064", "0.592704", "0.5909231", "0.5896396", "0.58840674", "0.5853...
0.69236904
0
The as_fieldset method returns the expected HTML content.
def test_as_fieldset(self): # form._html_output(self, row_tag, col_head_tag, col_tag, single_col_tag, col_head_data, col_data, # help_text_br, errors_on_separate_row, as_type=None, strict_columns=False) pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_change_form_fieldset(context, fieldset):\n return fieldset.render(context)", "def test_form_main_rows_html_fieldset_has_container(self):\n # form.form_main_rows(self, html_args, fieldsets, form_col_count)\n # html_args = (row_tag, col_head_tag, col_tag, single_col_tag, as_type, all_fi...
[ "0.68415874", "0.65187925", "0.64655817", "0.6356494", "0.6348469", "0.63407326", "0.6289891", "0.6259091", "0.58220214", "0.57917166", "0.57520664", "0.5586527", "0.5541364", "0.55403435", "0.55008024", "0.5432789", "0.54069513", "0.52744323", "0.525591", "0.52468085", "0.52...
0.8279127
0
Focus is never assigned to a hidden field when targeted.
def test_focus_not_on_hidden(self): target = 'hide_field' field = self.form.fields.get(target, None) result_name = self.form.assign_focus_field(target) focused = self.find_focus_field() self.assertTrue(isinstance(getattr(field, 'widget', None), (HiddenInput, MultipleHiddenInput,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def focus(self):\n raise NotImplementedError", "def XPLoseKeyboardFocus(inWidget):\n pass", "def _focus(self, event) -> None:\n self.focus = True", "def XPSetKeyboardFocus(inWidget):\n pass", "def setFocus(*args, **kwargs)->None:\n pass", "def OnSetFocus(self, event):\r\n\r\n ...
[ "0.6382761", "0.6354733", "0.6317249", "0.6208623", "0.61726147", "0.60827786", "0.60427195", "0.5998974", "0.5994161", "0.5970299", "0.59276265", "0.59212893", "0.5848262", "0.5848262", "0.5848262", "0.5848262", "0.58345133", "0.58045936", "0.57720476", "0.57620573", "0.5757...
0.7910866
0
Focus is never assigned to a disabled field when targeted.
def test_focus_not_on_disabled(self): target = 'disable_field' field = self.form.fields.get(target, None) result_name = self.form.assign_focus_field(target) focused = self.find_focus_field() self.assertTrue(field.disabled) self.assertIn(target, self.form.fields) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def XPLoseKeyboardFocus(inWidget):\n pass", "def test_focus_on_limited_fields(self):\n original_named_focus = self.form.named_focus\n original_fields_focus = self.form.fields_focus\n original_given_focus = self.form.given_focus\n original_fields = self.form.fields\n self.for...
[ "0.65576744", "0.6084644", "0.60535353", "0.60353684", "0.6023091", "0.5991919", "0.5899241", "0.58820546", "0.5868405", "0.5863868", "0.5862695", "0.5829498", "0.5777314", "0.5753486", "0.5707517", "0.5685013", "0.56837887", "0.5669752", "0.5669752", "0.5663315", "0.56414413...
0.7954488
0
All fields that previously had focus should have it removed when giving focus to another field.
def test_remove_previous_focus(self): target_1 = 'generic_field' result_1 = self.form.assign_focus_field(target_1) focused_1 = self.find_focus_field() target_2 = 'another_field' result_2 = self.form.assign_focus_field(target_2) focused_2 = self.find_focus_field() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop_focus(self):\n self._focus.pop()", "def OnKillFocus(self, event):\r\n\r\n self.Refresh()", "def OnKillFocus(self, event):\r\n\r\n self._hasFocus = False\r\n self.RefreshSelected()\r\n event.Skip()", "def remove_all_fields(self):\n self.fields = None", "def ...
[ "0.64085096", "0.6284488", "0.6279339", "0.62759113", "0.62412", "0.6222219", "0.61831456", "0.61306286", "0.60730654", "0.60544926", "0.6027801", "0.5896498", "0.58639044", "0.58150744", "0.5804271", "0.5801935", "0.5785319", "0.57268244", "0.5713611", "0.5705902", "0.569016...
0.7392664
0
Focus assignment can be limited to a subset of form fields by setting 'fields_focus' on form.
def test_focus_on_limited_fields(self): original_named_focus = self.form.named_focus original_fields_focus = self.form.fields_focus original_given_focus = self.form.given_focus original_fields = self.form.fields self.form.named_focus = None self.form.given_focus = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setFocus(*args, **kwargs)->None:\n pass", "def _focus(self, event) -> None:\n self.focus = True", "def setFocus(*args):", "def setFocus(*args):", "def setFocus(*args):", "def setFocus(*args):", "def force_focus_set(self, event):\n self.focus_set()", "def focus(self):\n rai...
[ "0.6319066", "0.59794223", "0.59114265", "0.59114265", "0.59114265", "0.59114265", "0.58348966", "0.5777872", "0.5764797", "0.5763939", "0.5720473", "0.56244254", "0.5585515", "0.55759245", "0.55622715", "0.5553491", "0.55013245", "0.54972106", "0.5487783", "0.5430203", "0.53...
0.77404433
0
After fields have been formed, get_critical_field should return from fields, not from base_fields.
def test_get_critical_from_existing_fields(self): name = 'generic_field' opts = {'names': (name, ), 'alt_field': '', 'computed': False} expected_field = self.form.fields.get(name, None) actual_name, actual_field = self.form.get_critical_field(opts['names']) self.assertEqual(name,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init_get_critical_for_needed(self):\n # needed_names = [nf for nf in ('country_display', 'country_flag') if nf not in self.form.base_fields]\n # for name in needed_names: name, field = self.get_critical_field(name, name)\n # original_get_critical_field = self.form.get_critical_field\n...
[ "0.7689682", "0.6882508", "0.6560968", "0.6231871", "0.6030528", "0.560576", "0.55169", "0.5483224", "0.5480227", "0.5467454", "0.5449506", "0.5420746", "0.53925157", "0.53286016", "0.5262026", "0.524784", "0.5220723", "0.5216728", "0.5207069", "0.51940817", "0.51895905", "...
0.7971704
0
If attach_critical_validators cannot access either fields or base_fields, it should raise as needed.
def test_raise_attach_broken(self): orig_fields = deepcopy(self.form.fields) orig_base_fields = deepcopy(self.form.base_fields) self.form.fields = None self.form.base_fields = None with self.assertRaises(ImproperlyConfigured): self.form.attach_critical_validators() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_raise_on_missing_critical(self):\n name_for_field = 'absent_field'\n field_opts = {'names': (name_for_field, 'absent'), 'alt_field': '', 'computed': False}\n critical_fields = {'absent_field': field_opts}\n with self.assertRaises(ImproperlyConfigured):\n self.form.fi...
[ "0.64744073", "0.6031441", "0.58538336", "0.5842086", "0.58299446", "0.57440895", "0.56509054", "0.56192964", "0.56120896", "0.5591077", "0.5500736", "0.5477261", "0.54311866", "0.5412474", "0.5382877", "0.5351321", "0.5345596", "0.5325084", "0.5323807", "0.53185827", "0.5316...
0.776859
0
Confirm tos_field is only present when configured to add the field.
def test_manage_tos_field(self): name = self.form.name_for_tos or 'tos_field' initial_is_off = self.form.tos_required is False found = self.form.fields.get(name, None) original_critical = deepcopy(self.form.critical_fields) self.form.tos_required = True expected = deepcop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tos_setup(self):\n self.assertTrue(self.form.tos_required)\n self.assertIsNotNone(self.form.name_for_tos)\n self.assertIsNotNone(self.form.fields.get(self.form.name_for_tos, None))", "def clean_tos(self):\r\n if self.cleaned_data.get('tos', False):\r\n return self....
[ "0.67858636", "0.62866366", "0.62055016", "0.61811095", "0.5965814", "0.5193065", "0.5122631", "0.4904365", "0.4875286", "0.48735622", "0.48606914", "0.48399997", "0.4826527", "0.48137578", "0.47887945", "0.47836968", "0.47045", "0.46824843", "0.4672949", "0.46623525", "0.465...
0.7094289
0
Confirm the form was instantiated with tos_required.
def test_tos_setup(self): self.assertTrue(self.form.tos_required) self.assertIsNotNone(self.form.name_for_tos) self.assertIsNotNone(self.form.fields.get(self.form.name_for_tos, None))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_tos(self):\r\n if self.cleaned_data.get('tos', False):\r\n return self.cleaned_data['tos']\r\n raise forms.ValidationError(_(u'You must agree to the terms to register'))", "def clean_tos(self):\n if self.cleaned_data.get('tos', False):\n return self.cleaned_da...
[ "0.6649071", "0.65329856", "0.6442008", "0.6201706", "0.6105612", "0.6058894", "0.5942685", "0.5837317", "0.5744072", "0.57023823", "0.5676579", "0.5644132", "0.5597428", "0.5588718", "0.557048", "0.5566174", "0.55490893", "0.55310315", "0.5505443", "0.5505102", "0.5501673", ...
0.71034855
0
The get_computed_field_names method should include the names when computed_fields is already determined.
def test_use_existing_computed_field_dict(self): if isinstance(self.form.computed_fields, list): self.form.computed_fields = self.form.get_computed_fields(self.form.computed_fields) self.form.fields.update(self.form.computed_fields) # only names in fields included in get_computed_field_name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_field_names() -> Sequence[str]:\n raise NotImplementedError", "def field_names(self):\n ...", "def test_init_update_computed_field_names(self):\n original_request = self.request\n original_form = self.form\n computed = getattr(self.form, 'computed_fields', None)\n ...
[ "0.63844585", "0.62912333", "0.62794363", "0.62603986", "0.62363034", "0.6190328", "0.61855924", "0.6114373", "0.6040428", "0.6024961", "0.60116583", "0.6000503", "0.599157", "0.5962834", "0.5922235", "0.59012467", "0.5882769", "0.5877933", "0.5828314", "0.5807871", "0.576512...
0.7097615
0
The computed_field_names method raises ImproperlyConfigured when computed_fields is an unexpected type.
def test_raise_on_corrupt_computed_fields(self): initial = self.form.computed_fields self.form.computed_fields = 'This is a broken value' with self.assertRaises(ImproperlyConfigured): self.form.get_computed_field_names([], self.form.fields) self.form.computed_fields = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_use_existing_computed_field_dict(self):\n if isinstance(self.form.computed_fields, list):\n self.form.computed_fields = self.form.get_computed_fields(self.form.computed_fields)\n self.form.fields.update(self.form.computed_fields) # only names in fields included in get_computed_fi...
[ "0.6899859", "0.6546997", "0.63082385", "0.6138751", "0.6072802", "0.605996", "0.60209787", "0.58762425", "0.58004105", "0.5780629", "0.56937295", "0.5666892", "0.5624716", "0.5612041", "0.5541064", "0.5533395", "0.55333376", "0.54615456", "0.5437734", "0.54309964", "0.542751...
0.69892365
0
Raises ImproperlyConfigured for missing cleaned_data on targeted field_names in constructing values.
def test_construct_values_raises_for_missing_cleaned_data(self): constructor_fields = ('first', 'second', 'last', ) if hasattr(self.form, 'cleaned_data'): del self.form.cleaned_data message = "This method can only be evaluated after 'cleaned_data' has been populated. " with s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_construct_values_raises_missing_cleaned_no_error(self):\n constructor_fields = ('first', 'second', 'last', )\n values = ['FirstValue', 'SecondValue', 'LastValue']\n cleaned_data = getattr(self.form, 'cleaned_data', {})\n cleaned_data.update(dict(zip(constructor_fields[:-1], val...
[ "0.7303688", "0.72501993", "0.6480992", "0.6454684", "0.64145434", "0.625035", "0.62435514", "0.6242395", "0.62124324", "0.6206833", "0.61525655", "0.60815203", "0.60424536", "0.6004057", "0.59829277", "0.5976123", "0.59505343", "0.59443766", "0.5935263", "0.5930225", "0.5912...
0.7748659
0
Return None from construct_value_from_values method if the relevant fields already have recorded errors.
def test_construct_values_skips_already_caught_errors(self): constructor_fields = ('first', 'second', 'last', ) values = ['FirstValue', 'SecondValue', 'LastValue'] expected = None # Normal is: '_'.join(ea for ea in values if ea).casefold() cleaned_data = getattr(self.form, 'cleaned_data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_construct_values_raises_missing_cleaned_no_error(self):\n constructor_fields = ('first', 'second', 'last', )\n values = ['FirstValue', 'SecondValue', 'LastValue']\n cleaned_data = getattr(self.form, 'cleaned_data', {})\n cleaned_data.update(dict(zip(constructor_fields[:-1], val...
[ "0.6116071", "0.60984635", "0.6093518", "0.6014954", "0.58889604", "0.5845769", "0.582053", "0.582053", "0.5777755", "0.57416", "0.5740918", "0.5679536", "0.5651429", "0.5633327", "0.5632272", "0.5578322", "0.55700237", "0.5566271", "0.5543094", "0.5540367", "0.55272776", "...
0.6645747
0
Return None from construct_value_from_values method if the relevant fields already have recorded errors.
def test_construct_values_raises_missing_cleaned_no_error(self): constructor_fields = ('first', 'second', 'last', ) values = ['FirstValue', 'SecondValue', 'LastValue'] cleaned_data = getattr(self.form, 'cleaned_data', {}) cleaned_data.update(dict(zip(constructor_fields[:-1], values[:-1])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_construct_values_skips_already_caught_errors(self):\n constructor_fields = ('first', 'second', 'last', )\n values = ['FirstValue', 'SecondValue', 'LastValue']\n expected = None # Normal is: '_'.join(ea for ea in values if ea).casefold()\n cleaned_data = getattr(self.form, 'cle...
[ "0.6646825", "0.6098643", "0.60949165", "0.6014171", "0.58864", "0.58449906", "0.582161", "0.582161", "0.5779063", "0.5741431", "0.5738686", "0.5678554", "0.56530637", "0.5630864", "0.5628875", "0.5584341", "0.55723536", "0.5568853", "0.55446196", "0.55417526", "0.5529097", ...
0.6117588
1
A computed field's custom compute method is called when appropriate in the _clean_computed_fields method.
def test_field_compute_method_called_in_clean_computed_fields(self): name = 'test_field' expected = 'compute_confirmed' self.form.test_value = expected modified = self.form.test_func(expected) original_func = deepcopy(self.form.test_func) def pass_through(value): return v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_field_clean_method_called_in_clean_computed_fields(self):\n name = 'test_field'\n expected = 'clean_confirmed'\n original_func = deepcopy(self.form.test_func)\n def replace_value(value): return expected\n self.form.test_func = replace_value\n if isinstance(self.fo...
[ "0.68851066", "0.66450715", "0.63397217", "0.6169532", "0.5776098", "0.5741612", "0.5698317", "0.56844103", "0.5668421", "0.5624036", "0.5601307", "0.551413", "0.551413", "0.5464949", "0.5451739", "0.5447752", "0.5444789", "0.5438681", "0.54166895", "0.54082006", "0.5313347",...
0.74964064
0
A computed field's custom clean method is called when appropriate in the _clean_computed_fields method.
def test_field_clean_method_called_in_clean_computed_fields(self): name = 'test_field' expected = 'clean_confirmed' original_func = deepcopy(self.form.test_func) def replace_value(value): return expected self.form.test_func = replace_value if isinstance(self.form.computed...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_field_compute_method_called_in_clean_computed_fields(self):\n name = 'test_field'\n expected = 'compute_confirmed'\n self.form.test_value = expected\n modified = self.form.test_func(expected)\n original_func = deepcopy(self.form.test_func)\n def pass_through(value...
[ "0.7071876", "0.6890784", "0.65769166", "0.6466059", "0.6421546", "0.615222", "0.61434525", "0.611279", "0.61122304", "0.609748", "0.60897005", "0.60114133", "0.5843924", "0.58362514", "0.58310366", "0.5709201", "0.56689227", "0.5666174", "0.5666049", "0.5630638", "0.562274",...
0.7312061
0
Test output of _clean_computed_fields. Should be an ErrorDict with computed field name(s) as key(s).
def test_validation_errors_assigned_in_clean_computed_fields(self): name = 'test_field' message = "This is the test error on test_field. " response = ValidationError(message) expected_compute_errors = ErrorDict({name: response}) # similar to return of _clean_computed_fields orig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_clean_moves_computed_fields_to_fields(self):\n name = 'test_field'\n if isinstance(self.form.computed_fields, (list, tuple)):\n self.form.computed_fields = self.form.get_computed_fields([name])\n computed_names = list(self.form.computed_fields.keys())\n field_names =...
[ "0.75391686", "0.7532654", "0.74328333", "0.7366892", "0.7289861", "0.71061695", "0.6932349", "0.6904049", "0.6860833", "0.6812228", "0.6632736", "0.6465598", "0.6200135", "0.59107816", "0.5845936", "0.57832646", "0.5644898", "0.55574524", "0.5552219", "0.55437005", "0.549937...
0.8140627
0
Raises ImproperlyConfigured if set_alt_data get both collection and single data input.
def test_raises_set_alt_data(self): name, value = 'generic_field', 'alt_data_value' field = self.form.fields.get(name, None) self.assertIsNotNone(field, "Unable to find the expected field in current fields. ") data = {name: (field, value)} with self.assertRaises(ImproperlyConfig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_alt_data_collection(self):\n names = list(self.test_data.keys())[1:-1]\n alt_values = {name: f\"alt_value_{name}\" for name in self.test_initial} # some, but not all, will be used.\n original_form_data = self.form.data\n test_data = self.test_data.copy()\n test_data...
[ "0.6740895", "0.63110775", "0.58376265", "0.5787795", "0.5517237", "0.53976166", "0.5333317", "0.53206915", "0.5248739", "0.52395374", "0.51345104", "0.5132322", "0.5106686", "0.50934315", "0.50909173", "0.50712544", "0.5013002", "0.50040066", "0.5002275", "0.49812916", "0.49...
0.6730341
1
After running set_alt_data that triggers changes, the Form's data attribute should have _mutable = False.
def test_set_alt_data_mutable(self): original_test_initial = self.test_initial original_form_data = self.form.data initial = self.test_initial test_data = self.test_data.copy() test_data.update({name: initial[name] for name in list(initial.keys())[1:-1]}) # two fields for alt_va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_alt_data_unchanged(self):\n original_form_data = self.form.data\n test_data = self.test_data.copy()\n test_data._mutable = False\n self.form.data = test_data\n initial_data = test_data.copy()\n alt_values = {name: f\"alt_value_{name}\" for name in self.test_in...
[ "0.75196934", "0.682521", "0.67945904", "0.6526392", "0.62162715", "0.6169545", "0.61402756", "0.614015", "0.60818297", "0.6079438", "0.59753525", "0.5968095", "0.5960009", "0.5838921", "0.5813265", "0.580115", "0.5800875", "0.5797445", "0.57854867", "0.57814664", "0.5761745"...
0.7199473
1
If all fields are not changed, then the Form's data is not overwritten.
def test_set_alt_data_unchanged(self): original_form_data = self.form.data test_data = self.test_data.copy() test_data._mutable = False self.form.data = test_data initial_data = test_data.copy() alt_values = {name: f"alt_value_{name}" for name in self.test_initial} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _replace_fields(self):\n for name, value in self._cleaned_data.items():\n setattr(self, name, value)", "def _clean(self):\n self.cleaned_data = super().clean()\n # Use bound data to set the value if we both have bound and initial data.\n if self.is_bound and self.initia...
[ "0.7125693", "0.6493488", "0.6476172", "0.6390869", "0.63886714", "0.63684744", "0.6261592", "0.6239529", "0.62338805", "0.62091047", "0.61917824", "0.61357147", "0.6092662", "0.60753626", "0.6056802", "0.6033103", "0.6012269", "0.6007175", "0.6002412", "0.5995106", "0.599151...
0.68604416
1
For a field name condition_ method returning true, updates the result as expected.
def test_update_condition_true(self): original_alt_info = getattr(self.form, 'alt_field_info', None) expected_label = 'alt_test_feature' test_method = getattr(self.form, 'condition_' + expected_label, None) alt_info = getattr(self, 'alt_field_info', None) expected = alt_info.get(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, fieldupdate='abc', condition='INVALID'):\n sql = self.generate_update_sql(fieldupdate, condition)\n self.sqlhistory.append(sql)\n return self.sql_update(sql)", "def _updateField(self, entity, entity_properties, name):\n\n from soc.logic.helper import org_app_survey as org...
[ "0.68372643", "0.5833345", "0.5775355", "0.55311084", "0.5475029", "0.5427229", "0.53909963", "0.53827405", "0.5348961", "0.53487056", "0.53487056", "0.5307851", "0.52772653", "0.5267646", "0.52673876", "0.5218061", "0.5189151", "0.517015", "0.5168191", "0.5159086", "0.514571...
0.6231951
1
Unchanged fields if 'remove_field_names' and 'removed_fields' are empty.
def test_unchanged_handle_removals(self): original_fields = self.form.fields fields = original_fields.copy() self.form.removed_fields = {} self.form.remove_field_names = [] result = self.form.handle_removals(fields) self.assertEqual(len(original_fields), len(result)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_handle_removals_missing_removed_fields(self):\n original_fields = self.form.fields\n fields = original_fields.copy()\n self.form.remove_field_names = []\n if hasattr(self.form, 'removed_fields'):\n del self.form.removed_fields\n result = self.form.handle_remov...
[ "0.74554706", "0.74491864", "0.72936064", "0.6925307", "0.6923496", "0.6707438", "0.64466757", "0.6417706", "0.62968796", "0.6211249", "0.6186095", "0.61174846", "0.610701", "0.6081443", "0.6038494", "0.59998083", "0.5926599", "0.58847034", "0.5825061", "0.5818654", "0.580955...
0.7591741
0
Unchanged fields. Form does not have removed_fields property initially, but it is added.
def test_handle_removals_missing_removed_fields(self): original_fields = self.form.fields fields = original_fields.copy() self.form.remove_field_names = [] if hasattr(self.form, 'removed_fields'): del self.form.removed_fields result = self.form.handle_removals(fields)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unchanged_handle_removals(self):\n original_fields = self.form.fields\n fields = original_fields.copy()\n self.form.removed_fields = {}\n self.form.remove_field_names = []\n result = self.form.handle_removals(fields)\n\n self.assertEqual(len(original_fields), len(...
[ "0.77649677", "0.7524932", "0.7281162", "0.7231894", "0.6988346", "0.68625975", "0.67639565", "0.6626596", "0.6497562", "0.6426146", "0.6331287", "0.62694836", "0.62495565", "0.6249388", "0.6208533", "0.6078891", "0.60334074", "0.6032778", "0.60258466", "0.60191256", "0.60039...
0.7574787
1
Fields whose name is in remove_field_names are removed from fields (with no form data).
def test_handle_removals_remove_field_names(self): original_fields = self.form.fields fields = original_fields.copy() remove_names = ['second', 'last'] expected_fields = {name: field for name, field in fields.items() if name not in remove_names} self.form.removed_fields = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_handle_removals_missing_remove_field_names(self):\n original_fields = self.form.fields\n fields = original_fields.copy()\n if hasattr(self.form, 'remove_field_names'):\n del self.form.remove_field_names\n\n with self.assertRaises(ImproperlyConfigured):\n s...
[ "0.74436945", "0.737302", "0.7368792", "0.7205383", "0.70427924", "0.6999577", "0.67760515", "0.67616045", "0.6653553", "0.6589306", "0.65694857", "0.6391059", "0.6376142", "0.63376814", "0.6242384", "0.62271845", "0.6207275", "0.6149979", "0.61190933", "0.6039027", "0.602740...
0.7726188
0
Fields whose name is in remove_field_names, but not named in form data, are removed from fields.
def test_handle_removals_named_fields_not_in_data(self): original_fields = self.form.fields fields = original_fields.copy() remove_names = ['second', 'last'] original_data = self.form.data data = original_data.copy() data.appendlist(remove_names[1], 'test_data_last') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_handle_removals_remove_field_names(self):\n original_fields = self.form.fields\n fields = original_fields.copy()\n remove_names = ['second', 'last']\n expected_fields = {name: field for name, field in fields.items() if name not in remove_names}\n self.form.removed_fields...
[ "0.7919481", "0.76232165", "0.733925", "0.71936774", "0.71093166", "0.7092437", "0.70440346", "0.67084694", "0.667372", "0.6472375", "0.63328904", "0.62806547", "0.62099826", "0.620513", "0.6195708", "0.60789603", "0.60676354", "0.60476226", "0.6041081", "0.6028844", "0.60090...
0.7789917
1
Applies overrides of field widget attrs if name is in overrides.
def test_prep_overrides(self): original_data = self.form.data test_data = original_data.copy() test_data._mutable = False self.form.data = test_data # copied only to allow tear-down reverting to original. original_fields = self.form.fields test_fields = original_fields.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_overrides(self, app, name, namespace,\n flag='reset', override_values=None):\n if override_values is None:\n override_values = {}\n body = {'flag': flag, 'values': override_values, 'attributes': {}}\n return self._update(self._path(app) +\n ...
[ "0.58639014", "0.58119094", "0.57164145", "0.5690681", "0.56085473", "0.53666663", "0.53194547", "0.53071195", "0.52736515", "0.5261119", "0.5206284", "0.51718056", "0.5151828", "0.51367855", "0.507694", "0.5039261", "0.50124925", "0.49915925", "0.49908444", "0.49711272", "0....
0.6050348
0
Applies expected measurements for a textarea form input.
def test_prep_textarea(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_TextAreaColsAndRows(request):\n schema = schemaish.Structure()\n schema.add('textAreaCustom', schemaish.String())\n\n form = formish.Form(schema, 'form')\n form['textAreaCustom'].widget = formish.TextArea(cols=20,rows=4)\n return form", "def calculate_char_in_textarea(context):\n conte...
[ "0.5577088", "0.5400031", "0.52361315", "0.50759006", "0.5063092", "0.50100446", "0.4869042", "0.48271298", "0.4776579", "0.47435308", "0.47408935", "0.47304356", "0.46997303", "0.4672879", "0.46539026", "0.46504828", "0.46376187", "0.46081394", "0.4606236", "0.46027762", "0....
0.66720796
0
The prep_fields method is called by _html_output because of definition in FormOverrideMixIn.
def test_prep_fields_called_html_output(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_make_fieldsets_uses_prep_fields(self):\n original_called_prep_fields = self.form.called_prep_fields = False\n full_fieldsets = self.form.make_fieldsets()\n\n self.assertFalse(original_called_prep_fields)\n self.assertIsInstance(full_fieldsets, (list, tuple))\n self.asser...
[ "0.68164235", "0.6493502", "0.63907284", "0.63283646", "0.6232555", "0.62033767", "0.6180277", "0.61739326", "0.6124719", "0.60883695", "0.60432965", "0.6012013", "0.59731865", "0.5861026", "0.58439845", "0.5822553", "0.5813767", "0.5795458", "0.57355815", "0.5726009", "0.571...
0.75277853
0
Raises ImproperlyConfigured if constructor_fields property is not a list or tuple of strings.
def test_raises_on_constructor_fields_error(self): self.form.constructor_fields = None message = "Expected a list of field name strings for constructor_fields. " with self.assertRaisesMessage(ImproperlyConfigured, message): self.form.confirm_required_fields()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_construct_values_raises_for_missing_cleaned_data(self):\n constructor_fields = ('first', 'second', 'last', )\n if hasattr(self.form, 'cleaned_data'):\n del self.form.cleaned_data\n message = \"This method can only be evaluated after 'cleaned_data' has been populated. \"\n ...
[ "0.5997121", "0.59445363", "0.59265906", "0.58876675", "0.584348", "0.57208145", "0.5712317", "0.5644994", "0.55909115", "0.54709804", "0.532488", "0.53136766", "0.5304112", "0.5294022", "0.5268261", "0.52323484", "0.5202136", "0.5167893", "0.51547426", "0.5135524", "0.508400...
0.7602628
0
Raises ImproperlyConfigured if missing any fields from constructor, username, email, and flag_field.
def test_raises_on_missing_needed_fields(self): test_name = "impossible_creature_not_present" self.form.constructor_fields = [*self.form.constructor_fields, test_name] message = "The fields for email, username, and constructor must be set in fields. " self.assertNotIn(test_name, self.for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n self.user_id = kwargs.get(\"user_id\")\n self.firstname = kwargs.get(\"firstname\")\n self.lastname = kwargs.get(\"lastname\")\n self.othernames = \"none\"\n self.username = kwargs.get(\"username\")\n self.email = kwargs.get(\"email\")\n ...
[ "0.6357581", "0.63517404", "0.63337785", "0.6269192", "0.62222046", "0.6208381", "0.61986077", "0.6190089", "0.6172834", "0.60944897", "0.60727406", "0.59823936", "0.5973203", "0.5972595", "0.58756524", "0.58631855", "0.58452314", "0.583517", "0.58163303", "0.58163303", "0.58...
0.6688426
0
Gets the effect that running the validator method has on the field's required attribute.
def validators_effect_required(self, field, func, *args, **kwargs): NOT_EXIST = '_MISSING_' original_required = getattr(field, 'required', NOT_EXIST) field.required = False func(*args, **kwargs) after_false = field.required field.required = True func(*args, **kwar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validation_required(self):\n return self._validation_required", "def required(self):\n return self._required", "def required(self):\n return self._required", "def is_required(self):\r\n return self._required", "def isRequired(self):\n return not self.isOptional()\n ...
[ "0.7846773", "0.7119182", "0.7119182", "0.69930714", "0.693971", "0.6885761", "0.66354066", "0.66354066", "0.6627754", "0.6611352", "0.6601932", "0.6595242", "0.65710676", "0.64031506", "0.6312467", "0.62659794", "0.61985457", "0.6147427", "0.6147427", "0.602703", "0.6014231"...
0.7132236
1
Returns how many validators are applied to a given field.
def validators_applied_count(self, field, func, *args, **kwargs): original_validators = field.validators field.validators = [] func(*args, **kwargs) result = len(field.validators) field.validators = original_validators return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNumValidators(self):\n return _libsbml.SBMLDocument_getNumValidators(self)", "def get_number_of_validation(self):\n return self.n_valid", "def validation_set_count(self) -> int:\n return pulumi.get(self, \"validation_set_count\")", "def field_length(self, fieldname):\n\t\t# todo: ...
[ "0.66500133", "0.64522016", "0.6205027", "0.59986514", "0.5799962", "0.57960945", "0.57889473", "0.56877226", "0.5686231", "0.56690854", "0.5652346", "0.5574244", "0.54889596", "0.5487244", "0.54550755", "0.54487497", "0.5423463", "0.54120666", "0.54112846", "0.5379686", "0.5...
0.77912045
0
The validators from name_for_user_validators are applied as expected.
def test_username_validators(self): name = self.form.name_for_user field_source = self.form.fields if name in self.form.fields else self.form.base_fields field = field_source.get(name, None) self.assertIsNotNone(field) expected = 2 count_strict = expected + 1 orig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_user(_):\n pass", "def validate(self, data):\n user_type = 3\n return validate_register_user(self, data, user_type)", "def find_user_validations() -> Type[ValidatorComposite]:\n\n arr_validations = [Builder.field(\"user_id\").required().build()]\n\n validations = sum(arr_va...
[ "0.6465854", "0.6126383", "0.60170776", "0.58740145", "0.58586645", "0.58527416", "0.58149683", "0.57209533", "0.5690418", "0.5666043", "0.5659131", "0.5653846", "0.56325513", "0.55936015", "0.557374", "0.55715215", "0.5543325", "0.55432403", "0.55430436", "0.55049217", "0.54...
0.68008995
0
The validators from name_for_email_validators are applied as expected.
def test_email_validators(self): name = self.form.name_for_email field = self.form.fields[name] expected = 2 count_strict = expected + 1 original_strict = getattr(self.form, 'strict_email', None) self.form.strict_email = False func = self.form.name_for_email_valid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, value):\n # Use the parent's handling of required fields, etc.\n super().validate(value)\n for email in value:\n validate_email(email)", "def test_email_username_validator(self):\n # Test with good data\n validator = self.validator.username_email_v...
[ "0.65610677", "0.6268303", "0.6046455", "0.6038639", "0.6019607", "0.60033554", "0.6002678", "0.6001875", "0.5987494", "0.5919595", "0.5918489", "0.58521897", "0.5850795", "0.5824184", "0.58181787", "0.58074874", "0.5795105", "0.5782553", "0.57596254", "0.57560974", "0.575078...
0.72215724
0
If email already used, uses constructor_fields to make a username in username_from_email_or_names.
def test_constructor_fields_used_when_email_fails(self): self.form.name_for_user = self.form._meta.model.USERNAME_FIELD self.form.name_for_email = self.form._meta.model.get_email_field_name() existing_email = self.user.email new_info = {'first_name': "Newbie", 'last_name': "Newsome", 'em...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, first_name, last_name, email, mobile, user_name):\n self.first_name = first_name\n self.last_name = last_name\n self.email = email\n self.mobile = mobile\n self.user_name = user_name", "def _user_from_name_or_email(username_or_email):\r\n username_or_email...
[ "0.64217675", "0.6367761", "0.63263166", "0.620328", "0.61865926", "0.61669844", "0.61543685", "0.6141236", "0.61404413", "0.6122232", "0.6121378", "0.60854435", "0.60776377", "0.6067628", "0.6064595", "0.6050339", "0.60310495", "0.6002653", "0.5994113", "0.5989058", "0.59890...
0.67416775
0
The get_login_message response for link_only and no text passed returns as expected.
def test_message_link_only_no_text(self): kwargs = dict(link_text=None, link_only=False, reset=False) kwargs['link_only'] = True urls = self.get_or_make_links(('login', 'password_reset')) for url in urls: self.assertIsNotNone(url) expected = self.mock_get_login_messag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_message_default_no_text(self):\n kwargs = dict(link_text=None, link_only=False, reset=False)\n urls = self.get_or_make_links(('login', 'password_reset'))\n for url in urls:\n self.assertIsNotNone(url)\n expected = self.mock_get_login_message(urls, **kwargs)\n ...
[ "0.7230947", "0.70962363", "0.67971355", "0.67545116", "0.6748592", "0.643117", "0.6277573", "0.5884468", "0.5872838", "0.5719129", "0.5480234", "0.5345491", "0.5312241", "0.53114134", "0.5304375", "0.52877814", "0.52394485", "0.5218567", "0.52141786", "0.5196675", "0.5196465...
0.7386957
0
The get_login_message response for link_only and no text passed returns as expected.
def test_message_default_no_text(self): kwargs = dict(link_text=None, link_only=False, reset=False) urls = self.get_or_make_links(('login', 'password_reset')) for url in urls: self.assertIsNotNone(url) expected = self.mock_get_login_message(urls, **kwargs) actual = se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_message_link_only_no_text(self):\n kwargs = dict(link_text=None, link_only=False, reset=False)\n kwargs['link_only'] = True\n urls = self.get_or_make_links(('login', 'password_reset'))\n for url in urls:\n self.assertIsNotNone(url)\n expected = self.mock_get_l...
[ "0.7386957", "0.70962363", "0.67971355", "0.67545116", "0.6748592", "0.643117", "0.6277573", "0.5884468", "0.5872838", "0.5719129", "0.5480234", "0.5345491", "0.5312241", "0.53114134", "0.5304375", "0.52877814", "0.52394485", "0.5218567", "0.52141786", "0.5196675", "0.5196465...
0.7230947
1
If user has already confirmed an atypical username, it is used without further confirmation checks.
def test_confirmed_username(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_confirmation_username_not_email(self):\n pass", "def confirm(key):\n manager = EmailManager.find_key(key)\n if not manager:\n # If key is wrong, return False\n return False\n\n if manager.is_active:\n # Do not reactivate users\n ret...
[ "0.6546913", "0.645693", "0.6228912", "0.6119424", "0.61139166", "0.61052537", "0.6049774", "0.6000137", "0.5972646", "0.5958401", "0.59570193", "0.5955518", "0.5894199", "0.5881494", "0.5861639", "0.5856036", "0.5800832", "0.57938457", "0.5792791", "0.5792492", "0.57751834",...
0.692972
0
The computed_fields are added to fields if there is no error in username or other computed fields.
def test_fields_updated_with_computed(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_use_existing_computed_field_dict(self):\n if isinstance(self.form.computed_fields, list):\n self.form.computed_fields = self.form.get_computed_fields(self.form.computed_fields)\n self.form.fields.update(self.form.computed_fields) # only names in fields included in get_computed_fi...
[ "0.63890314", "0.62018245", "0.6116187", "0.59539616", "0.5692047", "0.55805045", "0.5535306", "0.5493999", "0.5454478", "0.54456073", "0.5443392", "0.5390811", "0.53575176", "0.53219974", "0.5263193", "0.524624", "0.52195275", "0.515524", "0.5153089", "0.51446986", "0.508827...
0.654207
0
Raises ImproperlyConfigured if flag field cannot be found for configure_username_confirmation.
def test_raise_missing_flag_field(self): original_data = self.form.data original_fields = self.form.fields original_flag = self.form.USERNAME_FLAG_FIELD original_cleaned_data = getattr(self.form, 'cleaned_data', None) original_errors = getattr(self.form, '_errors', None) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_flag_handle_flag_field(self):\n original_flag_name = self.form.USERNAME_FLAG_FIELD\n self.form.USERNAME_FLAG_FIELD = \"This is not a valid field name\"\n expected = None\n actual = self.form.handle_flag_field(self.form.name_for_email, self.form.name_for_user)\n\n self...
[ "0.59824324", "0.5870834", "0.55834264", "0.55595756", "0.54770535", "0.5310007", "0.5213108", "0.5159476", "0.5083913", "0.50675964", "0.5053425", "0.4969892", "0.49602443", "0.49582785", "0.49546963", "0.4833263", "0.48224783", "0.48180395", "0.48155475", "0.47795367", "0.4...
0.62331486
0
The configure_username_confirmation method modifies the data, & fields, and returns expected message.
def test_configure_username_confirmation(self): original_data = self.form.data original_fields = self.form.fields original_computed_fields = self.form.computed_fields self.form.data = original_data.copy() self.form.fields = original_fields.copy() self.form.computed_fields...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_message_configure_username_confirmation(self):\n original_data = self.form.data\n original_fields = self.form.fields\n original_computed_fields = self.form.computed_fields\n original_errors = getattr(self.form, '_errors', None)\n original_cleaned_data = getattr(self.form...
[ "0.763387", "0.6376398", "0.6138468", "0.5720694", "0.57202744", "0.5622012", "0.53528005", "0.53144443", "0.52047443", "0.52019894", "0.5201963", "0.52017576", "0.51772255", "0.5149077", "0.5143668", "0.5108457", "0.5105089", "0.50788605", "0.50777745", "0.5037037", "0.50273...
0.6913565
1
The configure_username_confirmation method adds 'email' and 'username' errors and returns a message.
def test_message_configure_username_confirmation(self): original_data = self.form.data original_fields = self.form.fields original_computed_fields = self.form.computed_fields original_errors = getattr(self.form, '_errors', None) original_cleaned_data = getattr(self.form, 'cleaned...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_confirmation_username_not_email(self):\n pass", "def test_confirmed_username(self):\n pass", "def test_configure_username_confirmation(self):\n original_data = self.form.data\n original_fields = self.form.fields\n original_computed_fields = self.form.computed_fields\...
[ "0.60055816", "0.5580558", "0.54387224", "0.540235", "0.5364039", "0.5363893", "0.536015", "0.52718633", "0.51772916", "0.51737255", "0.5053862", "0.5028276", "0.50114393", "0.49868944", "0.49868944", "0.4983278", "0.49651885", "0.4959728", "0.4954731", "0.4945962", "0.492380...
0.684493
0
If not compute errors, clean method raises ValidationError for nonempty return from handle_flag_field.
def test_clean_calls_handle_flag_field(self): original_data = self.form.data original_fields = self.form.fields original_computed_fields = self.form.computed_fields original_errors = getattr(self.form, '_errors', None) original_cleaned_data = getattr(self.form, 'cleaned_data', No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_clean(self):\n self._errors = ErrorDict()\n if not self.is_bound: # Stop further processing.\n return\n self.cleaned_data = {}\n if self.empty_permitted and not self.has_changed():\n self.cleaned_data = None\n return\n for name, field in ...
[ "0.67317265", "0.66701466", "0.65613997", "0.6491003", "0.6457058", "0.63930887", "0.6362819", "0.6361536", "0.63591117", "0.63257307", "0.6325247", "0.6292585", "0.6270345", "0.6267574", "0.6267574", "0.62562644", "0.6236502", "0.6181659", "0.6137063", "0.6129618", "0.612554...
0.66912293
1
If there is no error found during handle_flag_field, expected return of an empty Dict.
def test_no_error_handle_flag_field(self): original_data = self.form.data original_fields = self.form.fields original_computed_fields = self.form.computed_fields original_errors = getattr(self.form, '_errors', None) original_cleaned_data = getattr(self.form, 'cleaned_data', None)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_handle_flag_error(self):\n pass", "def test_raise_missing_flag_field(self):\n original_data = self.form.data\n original_fields = self.form.fields\n original_flag = self.form.USERNAME_FLAG_FIELD\n original_cleaned_data = getattr(self.form, 'cleaned_data', None)\n ...
[ "0.60706633", "0.58114743", "0.5689423", "0.5565528", "0.54922634", "0.54514563", "0.5435839", "0.5322094", "0.52672726", "0.51822263", "0.5164868", "0.5127669", "0.51257294", "0.51159257", "0.51143193", "0.50291574", "0.50291574", "0.5001778", "0.49994832", "0.49979964", "0....
0.5925116
1
If current email matches an existing username, handle_flag_field returns a Dict with that error.
def test_username_of_email_exists_handle_flag_field(self): original_data = self.form.data original_fields = self.form.fields original_computed_fields = self.form.computed_fields original_errors = getattr(self.form, '_errors', None) original_cleaned_data = getattr(self.form, 'clea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_email_works_as_username_handle_flag_field(self):\n original_data = self.form.data\n original_fields = self.form.fields\n original_computed_fields = self.form.computed_fields\n original_errors = getattr(self.form, '_errors', None)\n original_cleaned_data = getattr(self.fo...
[ "0.66981214", "0.6349816", "0.62762165", "0.604796", "0.5953749", "0.5908456", "0.59008956", "0.58932865", "0.58932865", "0.58898187", "0.5876202", "0.58696085", "0.5861591", "0.58554953", "0.58522695", "0.5841933", "0.5832264", "0.58276683", "0.5810914", "0.57974815", "0.578...
0.6850138
0
Remove & return the named field if it had been moved from fields to removed_fields or computed_fields.
def get_missing_field(self, name): source = getattr(self.form, 'removed_fields', {}) if issubclass(self.form.__class__, ComputedFieldsMixIn): source = self.form.computed_fields field = source.pop(name, None) return field
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_remove_field(self, item, field_name):\n\t\treturn self._modify_object(item=item, field_name=field_name, new_value=None, new_field_name=None)", "def remove_field():\n _id = request.form['_id']\n data, code, message = FIELD_SERVICE.remove_field(_id)\n return __result(data, code, message)", "def...
[ "0.6972614", "0.6878197", "0.6414154", "0.60368294", "0.5986027", "0.59363645", "0.5931434", "0.59127325", "0.59127206", "0.58696914", "0.5852019", "0.58399874", "0.5787753", "0.5703484", "0.56468785", "0.5598534", "0.5577256", "0.55616206", "0.555367", "0.5531378", "0.551520...
0.73546433
0
Returns True if form.country_optional and form.data['country_flag'] are True, else returns False.
def test_condition_alt_country(self): original_flag = self.form.country_optional self.form.country_optional = True original_data = getattr(self.form, 'data', None) test_data = original_data.copy() test_data['country_flag'] = True self.form.data = test_data first_e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_clean_country_flag(self):\n # country_flag = self.cleaned_data.get('country_flag', None)\n # field = self.fields.get(self.country_field_name, None)\n # if not field and hasattr(self, 'computed_fields'):\n # field = self.computed_fields.get(self.country_field_name, None)\n ...
[ "0.7646883", "0.6458368", "0.64384305", "0.61835104", "0.61295354", "0.61058503", "0.60980874", "0.60951024", "0.59862053", "0.5962255", "0.5935159", "0.59304583", "0.5924629", "0.5859196", "0.58489645", "0.58467984", "0.5841211", "0.5815134", "0.57613146", "0.5755242", "0.57...
0.6825711
1
Returns unmodified inputs if form.country_optional is False.
def test_pass_through_prep_country_fields(self): original_flag = self.form.country_optional self.form.country_optional = False # True original_fields = self.form.fields self.form.fields = original_fields.copy() remaining_fields = original_fields.copy() opts, field_rows =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_prep_country_fields(self):\n original_flag = self.form.country_optional\n self.form.country_optional = True\n original_fields = self.form.fields\n original_removed = getattr(self.form, 'removed_fields', None)\n original_computed = getattr(self.form, 'computed_fields', No...
[ "0.6526117", "0.63131696", "0.61562216", "0.58682793", "0.57100934", "0.54811525", "0.5309421", "0.5280519", "0.52800024", "0.5198643", "0.5198643", "0.517737", "0.51279545", "0.50890446", "0.5059742", "0.5025401", "0.5019244", "0.49764037", "0.49680588", "0.4965016", "0.4952...
0.68379873
0