本文整理汇总了Python中model_mommy.recipe.seq函数的典型用法代码示例。如果您正苦于以下问题:Python seq函数的具体用法?Python seq怎么用?Python seq使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了seq函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_no_filter_shows_all_sizes_of_business
def test_no_filter_shows_all_sizes_of_business(self):
get_contract_recipe().make(_quantity=5, vendor_name=seq("Large Biz"), business_size='o')
get_contract_recipe().make(_quantity=5, vendor_name=seq("Small Biz"), business_size='s')
driver = self.load_and_wait()
self.assert_results_count(driver, 10)
self.assertIsNotNone(re.search(r'Small Biz\d+', driver.page_source))
self.assertIsNotNone(re.search(r'Large Biz\d+', driver.page_source))
示例2: setUp
def setUp(self):
self.dataset = mommy.make(Dataset)
self.zero_dataset = mommy.make(Dataset)
records = mommy.make(DatasetRecord, _quantity=10, value=seq(0))
zero_records = mommy.make(DatasetRecord, _quantity=10, value=seq(-1))
for record in records:
self.dataset.records.add(record)
for record in zero_records:
self.zero_dataset.records.add(record)
示例3: get_contract_recipe
def get_contract_recipe():
return Recipe(
Contract,
idv_piid=seq('ABC123'),
piid=piid,
vendor_name=seq("CompanyName"),
labor_category="Business Analyst II",
schedule=cycle(SCHEDULES),
min_years_experience=seq(5),
hourly_rate_year1=seq('2'),
current_price=seq('2'),
)
示例4: xtest_filter_to_only_small_businesses
def xtest_filter_to_only_small_businesses(self):
get_contract_recipe().make(_quantity=5, vendor_name=seq("Large Biz"), business_size="o")
get_contract_recipe().make(_quantity=5, vendor_name=seq("Small Biz"), business_size="s")
driver = self.load_and_wait()
form = self.get_form()
self.set_form_value(form, "business_size", "s")
self.submit_form_and_wait()
self.assert_results_count(driver, 5)
self.assertIsNone(re.search(r"Large Biz\d+", driver.page_source))
self.assertIsNotNone(re.search(r"Small Biz\d+", driver.page_source))
示例5: test_filter_experience_range
def test_filter_experience_range(self):
get_contract_recipe().make(_quantity=5, vendor_name=seq("4 years of experience"), min_years_experience=4)
get_contract_recipe().make(_quantity=5, vendor_name=seq("5 years of experience"), min_years_experience=5)
driver = self.load_and_wait()
form = self.get_form()
self.set_form_value(form, 'experience_range', '5,10')
self.submit_form_and_wait()
self.assert_results_count(driver, 5)
self.assertIsNone(re.search(r'4 years of experience\d+', driver.page_source))
self.assertIsNotNone(re.search(r'5 years of experience\d+', driver.page_source))
示例6: test_pesquisa_data_adesao_sistema_de_cultura
def test_pesquisa_data_adesao_sistema_de_cultura(client):
mommy.make('SistemaCultura', _quantity=5, ente_federado__cod_ibge=seq(110),
data_publicacao_acordo=seq(datetime.date(2018, 12, 21),
datetime.timedelta(days=1)), _fill_optional=True)
sistema_de_cultura = SistemaCultura.sistema.first()
data_param = '?data_adesao={}'.format(sistema_de_cultura.data_publicacao_acordo)
url = url_sistemadeculturalocal + data_param
request = client.get(url, content_type="application/hal+json")
assert len(request.data["_embedded"]["items"]) == 1
assert request.data["_embedded"]["items"][0]["data_adesao"] == str(sistema_de_cultura.data_publicacao_acordo)
示例7: test_filter_to_only_large_businesses
def test_filter_to_only_large_businesses(self):
get_contract_recipe().make(_quantity=5, vendor_name=seq("Large Biz"), business_size='o')
get_contract_recipe().make(_quantity=5, vendor_name=seq("Small Biz"), business_size='s')
driver = self.load_and_wait()
form = self.get_form()
self.set_form_value(form, 'business_size', 'o')
self.submit_form_and_wait()
self.assert_results_count(driver, 5)
self.assertIsNone(re.search(r'Small Biz\d+', driver.page_source))
self.assertIsNotNone(re.search(r'Large Biz\d+', driver.page_source))
示例8: test_filter_schedules
def test_filter_schedules(self):
get_contract_recipe().make(_quantity=5, vendor_name=seq("MOBIS"), schedule='MOBIS')
get_contract_recipe().make(_quantity=5, vendor_name=seq("AIMS"), schedule='AIMS')
driver = self.load_and_wait()
form = self.get_form()
self.set_form_value(form, 'schedule', 'MOBIS')
self.submit_form_and_wait()
self.assert_results_count(driver, 5)
self.assertIsNone(re.search(r'AIMS\d+', driver.page_source))
self.assertIsNotNone(re.search(r'MOBIS\d+', driver.page_source))
示例9: test_logarithmic_not_in_get_scale_options
def test_logarithmic_not_in_get_scale_options(self):
self.dataset = mommy.make(Dataset)
records = mommy.make(DatasetRecord, _quantity=10, value=seq(-5))
for record in records:
self.dataset.records.add(record)
scales = self.dataset.get_scale_options()
self.assertIn(SCALE_CHOICES[0], scales)
self.assertNotIn(SCALE_CHOICES[1], scales)
示例10: test_titles_are_correct
def test_titles_are_correct(self):
get_contract_recipe().make(_quantity=1,
labor_category=seq("Architect"))
driver = self.load_and_wait()
self.assertTrue(
driver.title.startswith('CALC'),
'Title mismatch, {} does not start with CALC'.format(driver.title)
)
示例11: test_defining_recipes_str
def test_defining_recipes_str(self):
from model_mommy.recipe import seq
p = Recipe("generic.Person", name=seq("foo"))
try:
p.make(_quantity=5)
except AttributeError as e:
self.fail("%s" % e)
示例12: test_defining_recipes_str
def test_defining_recipes_str(self):
from model_mommy.recipe import seq
p = Recipe('generic.Person',
name=seq('foo')
)
try:
p.make(_quantity=5)
except AttributeError, e:
self.fail('%s' %e)
示例13: xtest_price_lte
def xtest_price_lte(self):
# note: the hourly rates here will actually start at 80-- this seems
# like a bug, but whatever
get_contract_recipe().make(
_quantity=10, labor_category=seq("Contractor"), hourly_rate_year1=seq(70, 10), current_price=seq(70, 10)
)
driver = self.load()
form = self.get_form()
self.search_for("Contractor")
maximum = 100
# add results count check
self.set_form_value(form, "price__lte", maximum)
self.submit_form_and_wait()
self.assertTrue(
("price__lte=%d" % maximum) in driver.current_url, 'Missing "price__lte=%d" in query string' % maximum
)
self.assert_results_count(driver, 3)
示例14: test_there_is_no_business_size_column
def test_there_is_no_business_size_column(self):
get_contract_recipe().make(_quantity=5, vendor_name=seq("Large Biz"), business_size='o')
driver = self.load()
form = self.get_form()
col_headers = get_column_headers(driver)
for head in col_headers:
self.assertFalse(has_matching_class(head, 'column-business[_-]size'))
示例15: xtest_form_submit_loading
def xtest_form_submit_loading(self):
get_contract_recipe().make(_quantity=1, labor_category=seq("Architect"))
self.load()
self.search_for('Architect')
form = self.submit_form()
# print(self.driver.execute_script('document.querySelector("#search").className'))
self.assertTrue(has_class(form, 'loading'), "Form doesn't have 'loading' class")
self.wait_for(self.data_is_loaded)
self.assertTrue(has_class(form, 'loaded'), "Form doesn't have 'loaded' class")
self.assertFalse(has_class(form, 'loading'), "Form shouldn't have 'loading' class after loading")