function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
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 __init__(self, client, config, serializer, deserializer) -> None: self._client = client self._serialize = serializer self._deserialize = deserializer self._config = config
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_long_running_output(pipeline_response): deserialized = self._deserialize('Subnet', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
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_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {})
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def list( self, resource_group_name: str, virtual_network_name: str, **kwargs: 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 main(): out_dct = { "_comment_s10_countries": ( "The country code is part of the S10 standard for international" " mail. The official reference for this is here:" " http://www.upu.int/uploads/tx_sbdownloader/" "S10TechnicalStandard.pdf"), "_commen...
jkeen/tracking_number_data
[ 77, 29, 77, 11, 1497493117 ]
def fetch_country_data(): r = requests.get(URL) soup = bs4.BeautifulSoup(r.content, 'html.parser') for tag in soup.find_all("strong", attrs={"itemprop": "member"}): href = tag.nextSibling()[0] url2 = href.attrs['href'] yield grequests.get( join(BASE_URL, url2.lstrip('/'))...
jkeen/tracking_number_data
[ 77, 29, 77, 11, 1497493117 ]
def _get_value(attr, soup): _child = soup.find("div", class_=attr) if _child is None: return None, None child = _child.findChild(class_="field") if child.next_element.name == "a": # special handling for links value = child.next_element.attrs['href'] elif child.next_element.na...
jkeen/tracking_number_data
[ 77, 29, 77, 11, 1497493117 ]
def send(self, **k): mail_managers(self.subject(**k), self.message(**k))
joshsimmons/animportantdate
[ 6, 4, 6, 1, 1498342230 ]
def message(self, **k): return self.__TEMPLATE__.format_map(k)
joshsimmons/animportantdate
[ 6, 4, 6, 1, 1498342230 ]
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 delete( self, person_group_id, custom_headers=None, raw=False, **operation_config): """Delete an existing person group. Persisted face features of all people in the person group will also be deleted. :param person_group_id: Id referencing a particular person group. :type...
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get( self, person_group_id, return_recognition_model=False, custom_headers=None, raw=False, **operation_config): """Retrieve person group name, userData and recognitionModel. To get person information under this personGroup, use [PersonGroup Person - List](https://docs.microsoft....
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def update( self, person_group_id, name=None, user_data=None, custom_headers=None, raw=False, **operation_config): """Update an existing person group's display name and userData. The properties which does not appear in request body will not be updated. :param person_group_id: Id ref...
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_training_status( self, person_group_id, custom_headers=None, raw=False, **operation_config): """Retrieve the training status of a person group (completed or ongoing). :param person_group_id: Id referencing a particular person group. :type person_group_id: str :param ...
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def list( self, start=None, top=1000, return_recognition_model=False, custom_headers=None, raw=False, **operation_config): """List person groups’ personGroupId, name, userData and recognitionModel.<br /> * Person groups are stored in alphabetical order of personGroupId. * "st...
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def train( self, person_group_id, custom_headers=None, raw=False, **operation_config): """Queue a person group training task, the training task may not be started immediately. :param person_group_id: Id referencing a particular person group. :type person_group_id: str ...
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def mock_tmy3_weather_source(): tmp_dir = tempfile.mkdtemp() ws = TMY3WeatherSource("724838", tmp_dir, preload=False) ws.client = MockWeatherClient() ws._load_data() return ws
impactlab/eemeter
[ 25, 13, 25, 17, 1422563081 ]
def setUp(self): X, _ = datasets.load_iris(return_X_y=True) columns = ['Sepal length', 'Sepal width', 'Petal length', 'Sepal length'] self.X = pd.DataFrame(X, columns=columns)
MaxHalford/Prince
[ 951, 166, 951, 2, 1477139766 ]
def test_transform_pandas_dataframe(self): pca = prince.PCA(n_components=2) self.assertTrue(isinstance(pca.fit(self.X).transform(self.X), pd.DataFrame))
MaxHalford/Prince
[ 951, 166, 951, 2, 1477139766 ]
def test_transform_numpy_array(self): pca = prince.PCA(n_components=2) self.assertTrue(isinstance(pca.fit(self.X.values).transform(self.X.values), pd.DataFrame))
MaxHalford/Prince
[ 951, 166, 951, 2, 1477139766 ]
def test_fit_transform(self): # Without rescaling prince_pca = prince.PCA(n_components=3, rescale_with_mean=False, rescale_with_std=False) pd.testing.assert_frame_equal( prince_pca.fit_transform(self.X), prince_pca.fit(self.X).transform(self.X) ) # With ...
MaxHalford/Prince
[ 951, 166, 951, 2, 1477139766 ]
def test_explained_inertia_(self): pca = prince.PCA(n_components=4) pca.fit(self.X) self.assertTrue(np.isclose(sum(pca.explained_inertia_), 1))
MaxHalford/Prince
[ 951, 166, 951, 2, 1477139766 ]
def validate_metadata_prefix(value, **kwargs): """Check metadataPrefix. :param value: One of the metadata identifiers configured in ``OAISERVER_METADATA_FORMATS``. """ metadataFormats = current_app.config['OAISERVER_METADATA_FORMATS'] if value not in metadataFormats: raise Validatio...
inveniosoftware/invenio-oaiserver
[ 3, 41, 3, 12, 1439547138 ]
def from_iso_permissive(datestring, use_dateutil=True): """Parse an ISO8601-formatted datetime and return a datetime object. Inspired by the marshmallow.utils.from_iso function, but also accepts datestrings that don't contain the time. """ dateutil_available = False try:...
inveniosoftware/invenio-oaiserver
[ 3, 41, 3, 12, 1439547138 ]
def validate(self, data, **kwargs): """Check range between dates under keys ``from_`` and ``until``.""" if 'verb' in data and data['verb'] != self.__class__.__name__: raise ValidationError( # FIXME encode data 'This is not a valid OAI-PMH verb:{0}'.format(data...
inveniosoftware/invenio-oaiserver
[ 3, 41, 3, 12, 1439547138 ]
def check_extra_params_in_request(verb): """Check for extra arguments in incomming request.""" extra = set(request.values.keys()) - set([ getattr(f, 'load_from', None) or getattr( f, 'data_key', None) or f.name for f in verb.fields.values() ]) if extra: raise ValidationError(...
inveniosoftware/invenio-oaiserver
[ 3, 41, 3, 12, 1439547138 ]
def __init__(self, client, config, serializer, deserializer) -> None: self._client = client self._serialize = serializer self._deserialize = deserializer self._config = config
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def list( self, detailed: Optional[bool] = None, **kwargs: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def prepare_request(next_link=None): if not next_link:
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def list_by_resource_group( self, resource_group_name: str, **kwargs: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def prepare_request(next_link=None): if not next_link:
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_long_running_output(pipeline_response): response = pipeline_response.http_response deserialized = self._deserialize('AppServicePlan', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def list_web_apps_by_hybrid_connection( self, resource_group_name: str, name: str, namespace_name: str, relay_name: str, **kwargs: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def prepare_request(next_link=None): if not next_link:
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def list_hybrid_connections( self, resource_group_name: str, name: str, **kwargs: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def prepare_request(next_link=None): if not next_link:
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def list_web_apps( self, resource_group_name: str, name: str, skip_token: Optional[str] = None, filter: Optional[str] = None, top: Optional[str] = None, **kwargs: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def prepare_request(next_link=None): if not next_link:
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def list_usages( self, resource_group_name: str, name: str, filter: Optional[str] = None, **kwargs: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def prepare_request(next_link=None): if not next_link:
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def unicode_escape(text): """ Escapes unicode characters in the given string into a format compatible with Python, C#, C++11, and many other programming languages. BMP characters are escaped as ``\\u####`` and non-BMP characters are escaped as ``\\U########``. The former syntax is compatible with Ja...
sk89q/Plumeria
[ 35, 2, 35, 2, 1471646188 ]
def unicode_name(text): """ Finds the Unicode names for the given characters, up to 10 characters. """ return "\n".join(s + " **" + unicodedata.name(s, "?") + "**" for s in text[:10])
sk89q/Plumeria
[ 35, 2, 35, 2, 1471646188 ]
def unicode_code(text): """ Finds the Unicode code points for the given characters, up to 10 characters. """ return "\n".join("{} **{}**".format(s, ord(s)) for s in text[:10])
sk89q/Plumeria
[ 35, 2, 35, 2, 1471646188 ]
def register(self): pass
marteinn/Skeppa
[ 4, 1, 4, 1, 1455475132 ]
def test_validates_and_saves_input(self): self.user = UserFactory() data = { 'title': 'Foo', 'venue': 'Bar', 'start': timezone.now(), 'end': timezone.now() + timezone.timedelta(days=11), } form = EventForm(data=data, created_by=self.user) ...
bitmazk/django-event-rsvp
[ 19, 10, 19, 3, 1357893081 ]
def setup_function(_): np.random.seed(0) np.set_printoptions(threshold=np.inf, formatter={'float_kind':lambda x: "%.3f" % x})
welch/rasl
[ 46, 11, 46, 4, 1458753226 ]
def image_noise(likeimg, p=0.1): """sparse noise as described in RASL and RPCA papers""" sgn = np.random.choice((-1.0, 1.0), size=likeimg.shape) return sgn * np.random.binomial(1, p, size=likeimg.shape)
welch/rasl
[ 46, 11, 46, 4, 1458753226 ]
def test_inner_aligned_similarity(): inner_aligned(SimilarityTransform)
welch/rasl
[ 46, 11, 46, 4, 1458753226 ]
def test_inner_aligned_affine(): inner_aligned(AffineTransform)
welch/rasl
[ 46, 11, 46, 4, 1458753226 ]
def inner_jittered(T, inset=10, rtol=1e-3, atol=0): """move a stack of jittered noisy images in the direction of aligned""" image0 = gauss_image() Image = [image0 + image_noise(image0, p=.05) for _ in T] T = [tform.inset(image0.shape, inset) for tform in T] TImage, J = zip(*[warp_image_gradient(tfor...
welch/rasl
[ 46, 11, 46, 4, 1458753226 ]
def test_inner_jittered_similarity(): N = 40 ds, dtheta, dx, dy= .05, .05, 1, 1 Jitters = [[(np.random.random() * 2 - 1) * ds + 1, (np.random.random() * 2 - 1) * dtheta, (np.random.random() * 2 - 1) * dx, (np.random.random() * 2 - 1) * dy] for _...
welch/rasl
[ 46, 11, 46, 4, 1458753226 ]
def protoc_emitter(target, source, env): """Return list of targets generated by Protoc builder for source.""" for src in source: proto = os.path.splitext(str(src))[0] if env['PROTOCPPOUT']: target.append('%s.pb.cc' % (proto)) target.append('%s.pb.h' % (proto)) if ...
TheOstrichIO/sconseries
[ 6, 2, 6, 1, 1411017394 ]
def generate(env): """Add Builders, Scanners and construction variables for protoc to the build Environment.""" try: bldr = env['BUILDERS']['Protoc'] except KeyError: action = SCons.Action.Action('$PROTOCOM', '$PROTOCOMSTR') bldr = SCons.Builder.Builder(action=action, ...
TheOstrichIO/sconseries
[ 6, 2, 6, 1, 1411017394 ]
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 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_by_repl...
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 get( self, fabric_name, # type: str provider_name, # type: str **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def _create_initial( self, fabric_name, # type: str provider_name, # type: str add_provider_input, # type: "_models.AddRecoveryServicesProviderInput" **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def begin_create( self, fabric_name, # type: str provider_name, # type: str add_provider_input, # type: "_models.AddRecoveryServicesProviderInput" **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_long_running_output(pipeline_response): deserialized = self._deserialize('RecoveryServicesProvider', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def _purge_initial( self, fabric_name, # type: str provider_name, # type: str **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def begin_purge( self, fabric_name, # type: str provider_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 _refresh_provider_initial( self, fabric_name, # type: str provider_name, # type: str **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def begin_refresh_provider( self, fabric_name, # type: str provider_name, # type: str **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_long_running_output(pipeline_response): deserialized = self._deserialize('RecoveryServicesProvider', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def _delete_initial( self, fabric_name, # type: str provider_name, # type: str **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def begin_delete( self, fabric_name, # type: str provider_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 list( 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.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 __init__(self, user, connection, password=None, privateKey=None, publicKey=None): SSHUserAuthClient.__init__(self, user, connection) self.password = password self.privateKey = privateKey self.publicKey = publicKey
sporsh/carnifex
[ 7, 1, 7, 2, 1349465719 ]
def getPassword(self, prompt=None): if not self.password: return None # Return none to indicate we do not want to retry return defer.succeed(self.password)
sporsh/carnifex
[ 7, 1, 7, 2, 1349465719 ]
def __init__(self, response, shipwire_instance): r = response self.response = r j = r.json() self.json = j self.status = j.get('status') self.message = j.get('message') self.location = j.get('resourceLocation') self.resource_location = self.location ...
soylentme/shipwire-python
[ 15, 9, 15, 1, 1413840690 ]
def __init__(self, response, shipwire_instance): super(ListResponse, self).__init__(response, shipwire_instance) # check to make sure that you have a valid response if self.status is not HTTP_SUCCESS: return r = self.resource self.total = r.get('total') self...
soylentme/shipwire-python
[ 15, 9, 15, 1, 1413840690 ]
def __init__(self, filename, callback): super(PluginEventHandler, self).__init__(ignore_directories=True, regexes=['.*' + filename]) self.callback = callback
mike820324/microProxy
[ 17, 3, 17, 15, 1460816457 ]
def __init__(self, plugin_path): self.plugin_path = os.path.abspath(plugin_path) self.plugin_name = os.path.basename(self.plugin_path) self.plugin_dir = os.path.dirname(self.plugin_path) self.namespace = None self._load_plugin() self._register_watcher()
mike820324/microProxy
[ 17, 3, 17, 15, 1460816457 ]
def _load_plugin(self): sys.path.append(os.path.dirname(self.plugin_path)) try: with open(self.plugin_path) as fp: self.namespace = {"__file__": self.plugin_path} code = compile(fp.read(), self.plugin_path, "exec") exec (code, self.namespace, s...
mike820324/microProxy
[ 17, 3, 17, 15, 1460816457 ]
def __getattr__(self, attr): if attr not in self.PLUGIN_METHODS: raise AttributeError try: return self.namespace[attr] except KeyError: raise AttributeError
mike820324/microProxy
[ 17, 3, 17, 15, 1460816457 ]
def __init__(self, config): self.plugins = [] self.load_plugins(config["plugins"])
mike820324/microProxy
[ 17, 3, 17, 15, 1460816457 ]
def exec_request(self, plugin_context): if len(self.plugins) == 0: return plugin_context current_context = copy(plugin_context) for plugin in self.plugins: try: new_context = plugin.on_request(current_context) current_context = copy(new_co...
mike820324/microProxy
[ 17, 3, 17, 15, 1460816457 ]
def parse_arguments(): """Reads the arguments passed from command line. Command line Args: --json-config (str): Compulsory argument. The path to the JSON configuration file. --serial-requests (bool): Optional argument. Defines if the requests will be sent from the master to the workers ...
intracom-telecom-sdn/multinet
[ 14, 3, 14, 2, 1444836376 ]
def dpid_offset_range(num_vms): """Generate a range of dpid dpid_offset_list Every VM has allocates 1000 unique dpid offsets Args: num_vms (int): The number of virtual machines topo_size (int): The number of topology switches Returns: list: The dpid offset range """ return [i ...
intracom-telecom-sdn/multinet
[ 14, 3, 14, 2, 1444836376 ]
def make_post_request_runner(host_ip, host_port, route, data, queue): """Wrapper function to create a new job for each POST request. Make a POST request and put the response in a queue. Used for multiprocessing. Args: host_ip (str): The IP address of the REST server host_port (int): The por...
intracom-telecom-sdn/multinet
[ 14, 3, 14, 2, 1444836376 ]
def broadcast_cmd(worker_ip_list, worker_port_list, opcode, data=None): """Broadcast a POST request to all the workers Use multiple processes to send POST requests to a specified endpoint of all the workers simultaneously. Args: worker_ip_list (list): A list of IP addresses to broadcast the POST ...
intracom-telecom-sdn/multinet
[ 14, 3, 14, 2, 1444836376 ]
def test_user_creation(self): """ Create user and check his attributes """ user = UserFactory(username='johnsmith', name='John Smith') self.assertEqual('johnsmith', user.__unicode__()) self.assertEqual('John Smith', user.name) self.assertEqual('John Smith', user....
KlubJagiellonski/Politikon
[ 20, 21, 20, 29, 1433923333 ]
def test_user_urls(self): """ Check is urls are valid """ user = UserFactory( twitter_user='jsmith', facebook_user='facesmith' ) # TODO: FIXME # url = user.get_absolute_url() # self.assertEqual('/accounts/1/', url) # ...
KlubJagiellonski/Politikon
[ 20, 21, 20, 29, 1433923333 ]
def test_current_portfolio_value(self): """ Current portfolio value """ user = UserFactory() self.assertEqual(0, user.current_portfolio_value) event = EventFactory() bet = BetFactory(user=user, event=event) self.assertEqual(50, user.current_portfolio_value...
KlubJagiellonski/Politikon
[ 20, 21, 20, 29, 1433923333 ]
def test_reset_account_without_bonus(self): """ Test reset account """ user = UserFactory() user.reset_account() self.assertEqual({ 'user_id': 1, 'total_cash': formatted(1000), 'portfolio_value': formatted(0), 'reputation': ...
KlubJagiellonski/Politikon
[ 20, 21, 20, 29, 1433923333 ]
def test_get_newest_results(self): """ Get newest results """ users = UserFactory.create_batch(2) events = EventFactory.create_batch(5) BetFactory(user=users[0], event=events[0]) bet2 = BetFactory(user=users[0], event=events[1]) bet3 = BetFactory(user=user...
KlubJagiellonski/Politikon
[ 20, 21, 20, 29, 1433923333 ]
def test_return_new_user_object(self): """ Return new user object """ user = UserProfile.objects.return_new_user_object( username='j_smith', password='password9', ) self.assertIsInstance(user, UserProfile) self.assertEqual('j_smith', user.u...
KlubJagiellonski/Politikon
[ 20, 21, 20, 29, 1433923333 ]
def test_create_superuser(self): """ Create superuser """ user = UserProfile.objects.create_superuser( username='j_smith', email='j_smith@example.com', password='password9', ) self.assertIsInstance(user, UserProfile) self.assert...
KlubJagiellonski/Politikon
[ 20, 21, 20, 29, 1433923333 ]
def test_get_users(self): """ Get users """ user1 = UserFactory() UserFactory(is_deleted=True) UserFactory(is_active=False) users = UserProfile.objects.get_users() self.assertIsInstance(users[0], UserProfile) self.assertEqual(1, len(users)) ...
KlubJagiellonski/Politikon
[ 20, 21, 20, 29, 1433923333 ]
def test_get_admins(self): """ Get admins """ UserFactory() UserFactory(is_admin=True) UserFactory(is_staff=True) user4 = AdminFactory() admins = UserProfile.objects.get_admins() self.assertIsInstance(admins[0], UserProfile) self.assertEqu...
KlubJagiellonski/Politikon
[ 20, 21, 20, 29, 1433923333 ]
def test_get_best_monthly(self): """ Get best monthly """ UserFactory() user2 = UserFactory(monthly_result=300) AdminFactory() user4 = UserFactory(monthly_result=100) users = UserProfile.objects.get_best_monthly() self.assertEqual(0, len(users)) ...
KlubJagiellonski/Politikon
[ 20, 21, 20, 29, 1433923333 ]