function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def colorsrc(self, val): self["colorsrc"] = val
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def family(self): """ HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the prefer...
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def family(self, val): self["family"] = val
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def familysrc(self): """ Sets the source reference on Chart Studio Cloud for family .
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def familysrc(self, val): self["familysrc"] = val
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def size(self): """ The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf] - A tuple, list, or one-dimensional numpy array of the above Returns ------- int|float|numpy.ndarray """ return self["size"...
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def size(self, val): self["size"] = val
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def sizesrc(self): """ Sets the source reference on Chart Studio Cloud for size .
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def sizesrc(self, val): self["sizesrc"] = val
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def _prop_descriptions(self): return """\ color colorsrc Sets the source reference on Chart Studio Cloud for color . family HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to ...
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def __init__(self, ts=[], ids=[], index_cycles=[], slices=None, time_bounds=[], select_ids={}, container_label=None, experiment_label=None): # ts is a Coordinates instance self.container_label = container_label self.experiment_label = experiment_label if...
LeBarbouze/tunacell
[ 1, 5, 1, 1, 1502214471 ]
def timeseries(self): return self._timeseries
LeBarbouze/tunacell
[ 1, 5, 1, 1, 1502214471 ]
def __repr__(self): return repr(self.timeseries)
LeBarbouze/tunacell
[ 1, 5, 1, 1, 1502214471 ]
def __init__( self, plotly_name="templateitemname", parent_name="histogram2d.colorbar.tickformatstop", **kwargs
plotly/plotly.py
[ 13052, 2308, 13052, 1319, 1385013188 ]
def __init__( self, plotly_name="bgcolorsrc", parent_name="histogram.marker.pattern", **kwargs
plotly/plotly.py
[ 13052, 2308, 13052, 1319, 1385013188 ]
def setUp(self): self.tempdir = tempfile.mkdtemp() self.temppath = os.path.join(self.tempdir, "tempfile") self.mock_user = mock() self.mock_user.user_id = 1234
scottrice/Ice
[ 818, 108, 818, 209, 1356404560 ]
def test_previous_managed_ids_returns_none_for_missing_file(self): missing_path = os.path.join("some", "stupid", "path") self.assertFalse(os.path.exists(missing_path)) archive = ManagedROMArchive(missing_path) self.assertIsNone(archive.previous_managed_ids(self.mock_user))
scottrice/Ice
[ 818, 108, 818, 209, 1356404560 ]
def test_previous_managed_ids_returns_empty_list_for_missing_user(self): data = { "1337": [] } with open(self.temppath, "w+") as f: f.write(json.dumps(data)) archive = ManagedROMArchive(self.temppath) self.assertEquals(archive.previous_managed_ids(self.mock_user), [])
scottrice/Ice
[ 818, 108, 818, 209, 1356404560 ]
def test_set_managed_ids_creates_new_file_if_needed(self): self.assertFalse(os.path.exists(self.temppath)) archive = ManagedROMArchive(self.temppath) archive.set_managed_ids(self.mock_user, ["1234567890"]) self.assertTrue(os.path.exists(self.temppath))
scottrice/Ice
[ 818, 108, 818, 209, 1356404560 ]
def make_lemmatizer( nlp: Language, model: Optional[Model], name: str, mode: str, overwrite: bool
spacy-io/spaCy
[ 25459, 4045, 25459, 98, 1404400540 ]
def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer self._config = config
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def begin_delete( self, resource_group_name, # type: str azure_firewall_name, # type: str **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {})
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get( self, resource_group_name, # type: str azure_firewall_name, # type: str **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def _create_or_update_initial( self, resource_group_name, # type: str azure_firewall_name, # type: str parameters, # type: "_models.AzureFirewall" **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def begin_create_or_update( self, resource_group_name, # type: str azure_firewall_name, # type: str parameters, # type: "_models.AzureFirewall" **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_long_running_output(pipeline_response): deserialized = self._deserialize('AzureFirewall', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def update_tags( self, resource_group_name, # type: str azure_firewall_name, # type: str parameters, # type: "_models.AzureFirewall" **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def list( self, resource_group_name, # type: str **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL url = self.list.metadat...
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=resp...
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def list_all( self, **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL url = self.list_all.met...
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=resp...
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def test_upload_letters_button_only_with_letters_permission( client_request, service_one, mock_get_uploads, mock_get_jobs, mock_get_no_contact_lists, extra_permissions,
alphagov/notifications-admin
[ 38, 31, 38, 7, 1447854917 ]
def test_all_users_have_upload_contact_list( client_request, mock_get_uploads, mock_get_jobs, mock_get_no_contact_lists, user,
alphagov/notifications-admin
[ 38, 31, 38, 7, 1447854917 ]
def test_get_upload_hub_with_no_uploads( mocker, client_request, service_one, mock_get_no_uploads, mock_get_no_contact_lists, extra_permissions, expected_empty_message,
alphagov/notifications-admin
[ 38, 31, 38, 7, 1447854917 ]
def test_get_upload_hub_page( mocker, client_request, service_one, mock_get_uploads, mock_get_no_contact_lists,
alphagov/notifications-admin
[ 38, 31, 38, 7, 1447854917 ]
def test_get_uploaded_letters( mocker, client_request, service_one, mock_get_uploaded_letters,
alphagov/notifications-admin
[ 38, 31, 38, 7, 1447854917 ]
def test_get_empty_uploaded_letters_page( mocker, client_request, service_one, mock_get_no_uploaded_letters,
alphagov/notifications-admin
[ 38, 31, 38, 7, 1447854917 ]
def test_get_uploaded_letters_passes_through_page_argument( mocker, client_request, service_one, mock_get_uploaded_letters,
alphagov/notifications-admin
[ 38, 31, 38, 7, 1447854917 ]
def test_get_uploaded_letters_404s_for_bad_page_arguments( mocker, client_request,
alphagov/notifications-admin
[ 38, 31, 38, 7, 1447854917 ]
def test_get_uploaded_letters_404s_for_invalid_date( mocker, client_request,
alphagov/notifications-admin
[ 38, 31, 38, 7, 1447854917 ]
def test_uploads_page_shows_scheduled_jobs( mocker, client_request, mock_get_no_uploads, mock_get_jobs, mock_get_no_contact_lists, user,
alphagov/notifications-admin
[ 38, 31, 38, 7, 1447854917 ]
def test_uploads_page_shows_contact_lists_first( mocker, client_request, mock_get_no_uploads, mock_get_jobs, mock_get_contact_lists, mock_get_service_data_retention,
alphagov/notifications-admin
[ 38, 31, 38, 7, 1447854917 ]
def test_get_uploads_shows_pagination( client_request, active_user_with_permissions, mock_get_jobs, mock_get_uploads, mock_get_no_contact_lists,
alphagov/notifications-admin
[ 38, 31, 38, 7, 1447854917 ]
def test_capitalize(self, size): SUBSTR = ' abc def ghi' s = '-' * size + SUBSTR caps = s.capitalize() self.assertEquals(caps[-len(SUBSTR):], SUBSTR.capitalize()) self.assertEquals(caps.lstrip('-'), SUBSTR)
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_center(self, size): SUBSTR = ' abc def ghi' s = SUBSTR.center(size) self.assertEquals(len(s), size) lpadsize = rpadsize = (len(s) - len(SUBSTR)) // 2 if len(s) % 2: lpadsize += 1 self.assertEquals(s[lpadsize:-rpadsize], SUBSTR) self.as...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_center_unicode(self, size): SUBSTR = u' abc def ghi' try: s = SUBSTR.center(size) except OverflowError: pass # acceptable on 32-bit else: self.assertEquals(len(s), size) lpadsize = rpadsize = (len(s) - len(SUBSTR)) // 2 ...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_count(self, size): SUBSTR = ' abc def ghi' s = '.' * size + SUBSTR self.assertEquals(s.count('.'), size) s += '.' self.assertEquals(s.count('.'), size + 1) self.assertEquals(s.count(' '), 3) self.assertEquals(s.count('i'), 1) self.assertEq...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_decode(self, size): s = '.' * size self.assertEquals(len(s.decode('utf-8')), size)
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def basic_encode_test(self, size, enc, c=u'.', expectedsize=None): if expectedsize is None: expectedsize = size
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_encode(self, size): return self.basic_encode_test(size, 'utf-8')
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_encode_raw_unicode_escape(self, size): try: return self.basic_encode_test(size, 'raw_unicode_escape') except MemoryError: pass # acceptable on 32-bit
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_encode_utf7(self, size): try: return self.basic_encode_test(size, 'utf7') except MemoryError: pass # acceptable on 32-bit
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_encode_utf32(self, size): try: return self.basic_encode_test(size, 'utf32', expectedsize=4*size+4) except MemoryError: pass # acceptable on 32-bit
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_decodeascii(self, size): return self.basic_encode_test(size, 'ascii', c='A')
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_unicode_repr_oflw(self, size): try: s = u"\uAAAA"*size r = repr(s) except MemoryError: pass # acceptable on 32-bit else: self.failUnless(s == eval(r))
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_endswith(self, size): SUBSTR = ' abc def ghi' s = '-' * size + SUBSTR self.failUnless(s.endswith(SUBSTR)) self.failUnless(s.endswith(s)) s2 = '...' + s self.failUnless(s2.endswith(s)) self.failIf(s.endswith('a' + SUBSTR)) self.failIf(SUBST...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_expandtabs(self, size): s = '-' * size tabsize = 8 self.assertEquals(s.expandtabs(), s) del s slen, remainder = divmod(size, tabsize) s = ' \t' * slen s = s.expandtabs(tabsize) self.assertEquals(len(s), size - remainder) sel...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_find(self, size): SUBSTR = ' abc def ghi' sublen = len(SUBSTR) s = ''.join([SUBSTR, '-' * size, SUBSTR]) self.assertEquals(s.find(' '), 0) self.assertEquals(s.find(SUBSTR), 0) self.assertEquals(s.find(' ', sublen), sublen + size) self.assertEquals(...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_index(self, size): SUBSTR = ' abc def ghi' sublen = len(SUBSTR) s = ''.join([SUBSTR, '-' * size, SUBSTR]) self.assertEquals(s.index(' '), 0) self.assertEquals(s.index(SUBSTR), 0) self.assertEquals(s.index(' ', sublen), sublen + size) self.assertEqu...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_isalnum(self, size): SUBSTR = '123456' s = 'a' * size + SUBSTR self.failUnless(s.isalnum()) s += '.' self.failIf(s.isalnum())
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_isalpha(self, size): SUBSTR = 'zzzzzzz' s = 'a' * size + SUBSTR self.failUnless(s.isalpha()) s += '.' self.failIf(s.isalpha())
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_isdigit(self, size): SUBSTR = '123456' s = '9' * size + SUBSTR self.failUnless(s.isdigit()) s += 'z' self.failIf(s.isdigit())
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_islower(self, size): chars = ''.join([ chr(c) for c in range(255) if not chr(c).isupper() ]) repeats = size // len(chars) + 2 s = chars * repeats self.failUnless(s.islower()) s += 'A' self.failIf(s.islower())
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_isspace(self, size): whitespace = ' \f\n\r\t\v' repeats = size // len(whitespace) + 2 s = whitespace * repeats self.failUnless(s.isspace()) s += 'j' self.failIf(s.isspace())
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_istitle(self, size): SUBSTR = '123456' s = ''.join(['A', 'a' * size, SUBSTR]) self.failUnless(s.istitle()) s += 'A' self.failUnless(s.istitle()) s += 'aA' self.failIf(s.istitle())
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_isupper(self, size): chars = ''.join([ chr(c) for c in range(255) if not chr(c).islower() ]) repeats = size // len(chars) + 2 s = chars * repeats self.failUnless(s.isupper()) s += 'a' self.failIf(s.isupper())
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_join(self, size): s = 'A' * size x = s.join(['aaaaa', 'bbbbb']) self.assertEquals(x.count('a'), 5) self.assertEquals(x.count('b'), 5) self.failUnless(x.startswith('aaaaaA')) self.failUnless(x.endswith('Abbbbb'))
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_ljust(self, size): SUBSTR = ' abc def ghi' s = SUBSTR.ljust(size) self.failUnless(s.startswith(SUBSTR + ' ')) self.assertEquals(len(s), size) self.assertEquals(s.strip(), SUBSTR.strip())
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_lower(self, size): s = 'A' * size s = s.lower() self.assertEquals(len(s), size) self.assertEquals(s.count('a'), size)
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_lstrip(self, size): SUBSTR = 'abc def ghi' s = SUBSTR.rjust(size) self.assertEquals(len(s), size) self.assertEquals(s.lstrip(), SUBSTR.lstrip()) del s s = SUBSTR.ljust(size) self.assertEquals(len(s), size) stripped = s.lstrip() se...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_replace(self, size): replacement = 'a' s = ' ' * size s = s.replace(' ', replacement) self.assertEquals(len(s), size) self.assertEquals(s.count(replacement), size) s = s.replace(replacement, ' ', size - 4) self.assertEquals(len(s), size) s...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_rfind(self, size): SUBSTR = ' abc def ghi' sublen = len(SUBSTR) s = ''.join([SUBSTR, '-' * size, SUBSTR]) self.assertEquals(s.rfind(' '), sublen + size + SUBSTR.rfind(' ')) self.assertEquals(s.rfind(SUBSTR), sublen + size) self.assertEquals(s.rfind(' ', 0, ...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_rindex(self, size): SUBSTR = ' abc def ghi' sublen = len(SUBSTR) s = ''.join([SUBSTR, '-' * size, SUBSTR]) self.assertEquals(s.rindex(' '), sublen + size + SUBSTR.rindex(' ')) self.assertEquals(s.rindex(SUBSTR), sublen + size) sel...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_rjust(self, size): SUBSTR = ' abc def ghi' s = SUBSTR.ljust(size) self.failUnless(s.startswith(SUBSTR + ' ')) self.assertEquals(len(s), size) self.assertEquals(s.strip(), SUBSTR.strip())
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_rstrip(self, size): SUBSTR = ' abc def ghi' s = SUBSTR.ljust(size) self.assertEquals(len(s), size) self.assertEquals(s.rstrip(), SUBSTR.rstrip()) del s s = SUBSTR.rjust(size) self.assertEquals(len(s), size) stripped = s.rstrip() s...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_split_small(self, size): # Crudely calculate an estimate so that the result of s.split won't # take up an inordinate amount of memory chunksize = int(size ** 0.5 + 2) SUBSTR = 'a' + ' ' * chunksize s = SUBSTR * chunksize l = s.split() self.assertEq...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_split_large(self, size): s = ' a' * size + ' ' l = s.split() self.assertEquals(len(l), size) self.assertEquals(set(l), set(['a'])) del l l = s.split('a') self.assertEquals(len(l), size + 1) self.assertEquals(set(l), set([' ']))
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_splitlines(self, size): # Crudely calculate an estimate so that the result of s.split won't # take up an inordinate amount of memory chunksize = int(size ** 0.5 + 2) // 2 SUBSTR = ' ' * chunksize + '\n' + ' ' * chunksize + '\r\n' s = SUBSTR * chunksize l = ...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_startswith(self, size): SUBSTR = ' abc def ghi' s = '-' * size + SUBSTR self.failUnless(s.startswith(s)) self.failUnless(s.startswith('-' * size)) self.failIf(s.startswith(SUBSTR))
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_strip(self, size): SUBSTR = ' abc def ghi ' s = SUBSTR.rjust(size) self.assertEquals(len(s), size) self.assertEquals(s.strip(), SUBSTR.strip()) del s s = SUBSTR.ljust(size) self.assertEquals(len(s), size) self.assertEquals(s.strip(), S...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_swapcase(self, size): SUBSTR = "aBcDeFG12.'\xa9\x00" sublen = len(SUBSTR) repeats = size // sublen + 2 s = SUBSTR * repeats s = s.swapcase() self.assertEquals(len(s), sublen * repeats) self.assertEquals(s[:sublen * 3], SUBSTR.swapcase() * 3) ...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_title(self, size): SUBSTR = 'SpaaHAaaAaham' s = SUBSTR * (size // len(SUBSTR) + 2) s = s.title() self.failUnless(s.startswith((SUBSTR * 3).title())) self.failUnless(s.endswith(SUBSTR.lower() * 3))
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_translate(self, size): trans = string.maketrans('.aZ', '-!$') SUBSTR = 'aZz.z.Aaz.' sublen = len(SUBSTR) repeats = size // sublen + 2 s = SUBSTR * repeats s = s.translate(trans) self.assertEquals(len(s), repeats * sublen) self.assertEquals...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_upper(self, size): s = 'a' * size s = s.upper() self.assertEquals(len(s), size) self.assertEquals(s.count('A'), size)
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_zfill(self, size): SUBSTR = '-568324723598234' s = SUBSTR.zfill(size) self.failUnless(s.endswith('0' + SUBSTR[1:])) self.failUnless(s.startswith('-0')) self.assertEquals(len(s), size) self.assertEquals(s.count('0'), size - len(SUBSTR))
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_format(self, size): s = '-' * size sf = '%s' % (s,) self.failUnless(s == sf) del sf sf = '..%s..' % (s,) self.assertEquals(len(sf), len(s) + 4) self.failUnless(sf.startswith('..-')) self.failUnless(sf.endswith('-..')) del s, sf
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_repr_small(self, size): s = '-' * size s = repr(s) self.assertEquals(len(s), size + 2) self.assertEquals(s[0], "'") self.assertEquals(s[-1], "'") self.assertEquals(s.count('-'), size) del s # repr() will create a string four times as large...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_repr_large(self, size): s = '\x00' * size s = repr(s) self.assertEquals(len(s), size * 4 + 2) self.assertEquals(s[0], "'") self.assertEquals(s[-1], "'") self.assertEquals(s.count('\\'), size) self.assertEquals(s.count('0'), size * 2)
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_unicode_repr(self, size): s = u"\uAAAA" * size self.failUnless(len(repr(s)) > size)
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_concat(self, size): s = '.' * size self.assertEquals(len(s), size) s = s + s self.assertEquals(len(s), size * 2) self.assertEquals(s.count('.'), size * 2)
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_repeat(self, size): s = '.' * size self.assertEquals(len(s), size) s = s * 2 self.assertEquals(len(s), size * 2) self.assertEquals(s.count('.'), size * 2)
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_slice_and_getitem(self, size): SUBSTR = '0123456789' sublen = len(SUBSTR) s = SUBSTR * (size // sublen) stepsize = len(s) // 100 stepsize = stepsize - (stepsize % sublen) for i in range(0, len(s) - stepsize, stepsize): self.assertEquals(s[i], S...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_contains(self, size): SUBSTR = '0123456789' edge = '-' * (size // 2) s = ''.join([edge, SUBSTR, edge]) del edge self.failUnless(SUBSTR in s) self.failIf(SUBSTR * 2 in s) self.failUnless('-' in s) self.failIf('a' in s) s += 'a' ...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_compare(self, size): s1 = '-' * size s2 = '-' * size self.failUnless(s1 == s2) del s2 s2 = s1 + 'a' self.failIf(s1 == s2) del s2 s2 = '.' * size self.failIf(s1 == s2)
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_hash(self, size): # Not sure if we can do any meaningful tests here... Even if we # start relying on the exact algorithm used, the result will be # different depending on the size of the C 'long int'. Even this # test is dodgy (there's no *guarantee* that the two things sh...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def test_compare(self, size): t1 = (u'',) * size t2 = (u'',) * size self.failUnless(t1 == t2) del t2 t2 = (u'',) * (size + 1) self.failIf(t1 == t2) del t2 t2 = (1,) * size self.failIf(t1 == t2)
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def basic_concat_test(self, size): t = ((),) * size self.assertEquals(len(t), size) t = t + t self.assertEquals(len(t), size * 2)
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]