Best Python code snippet using autotest_python
test_for_tdd.py
Source:test_for_tdd.py
...36 expr = Parser("True OR False OR True").expr37 assert expr._op_str == "OR"38 assert [n._val for n in expr._operands] == ["True", "False", "True"]39class TestFilter:40 def test_simple_filtering(self, table_):41 filter_ = Filter(table_, "id > 1 AND owner_id = 1")42 assert filter_.table == [43 {"id": 2, "owner_id": 1, "name": "dog"},44 {"id": 3, "owner_id": 1, "name": "cat"},45 ]46 def test_double_logical_filtering(self, table_):47 filter_ = Filter(table_, "id = 3 OR owner_id = 2")48 assert filter_.table == [49 {"id": 1, "owner_id": 2, "name": "parrot"},50 {"id": 3, "owner_id": 1, "name": "cat"},51 ]52 def test_string_comparison(self, table_):53 filter_ = Filter(table_, "name = parrot")54 assert filter_.table == [...
test_opportunities.py
Source:test_opportunities.py
...12 new_opp = opportunity.filter(curies)13 assert opportunity == new_opp #same object14 assert new_opp.kg_ids == curies # no change15 assert new_opp.answer_indices == [0,1,2]16def test_simple_filtering():17 """When a curie is removed, return a new opp with the relevant kg_id and answer removed"""18 # Create opp19 curies = ['curie:1', 'curie:2', 'curie:3']20 #opportunity is 1 kg_id per answer21 opportunity = Opportunity('hash', ('qg_0', 'biolink:SmallMolecule'), curies, [0, 1, 2],22 {i: [curies[i]] for i in range(3)})23 keep_curies = curies[0:-1]24 new_opp = opportunity.filter(keep_curies)25 assert not opportunity == new_opp # new object26 assert set(new_opp.kg_ids) == set(keep_curies) # changed27 assert new_opp.answer_indices == [0, 1] #answer 2 removed28def test_complex_filtering():29 """When any curie for an answer is removed, make sure the whole answer is gone"""30 # Create opp...
test_filter_query.py
Source:test_filter_query.py
...3from apps.core.smtpd import Lurker4from apps.filters import models5class FilterModelsTestCase(TestCase):6 fixtures = ['accounts/test_simple.json', 'mails/test_simple.json']7 def test_simple_filtering(self):8 filterset = models.FilterSet.objects.create(9 name='Test Filter',10 created_by=User.objects.get(pk=1),11 is_global=True,12 is_active=True,13 icon='fa fa-filter',14 combine='and'15 )16 self.assertIsInstance(filterset, models.FilterSet)17 rule = models.Rule.objects.create(18 filter_set=filterset,19 field='peer',20 operator='iexact',21 value='127.0.0.1',...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!