def test_equality(self): ctx01 = DeviceContext('ctx01') ctx02 = DeviceContext('ctx02') ctx03 = DeviceContext('ctx03') assert_equals(self.ctx01, ctx01) assert_not_equals(self.ctx01, ctx03) assert_not_equals(ctx02, ctx03)
def test_app_data(self): tools.assert_equals({}, self.publishable.app_data) self.publishable.app_data['core'] = 'testing' self.publishable.save() p = self.publishable.content_type.get_object_for_this_type(pk=self.publishable.pk) tools.assert_equals({'core': 'testing'}, self.publishable.app_data)
def test_single_creator(self): """Test a product with a single creator """ product = self.amazon.lookup(ItemId="B00005NZJA") creators = dict(product.creators) assert_equals(creators[u"Jonathan Davis"], u"Narrator") assert_equals(len(creators.values()), 1)
def test_edit_issue(self): # goto issue show page env = {'REMOTE_USER': self.owner['name'].encode('ascii')} response = self.app.get( url=toolkit.url_for('issues_show', dataset_id=self.dataset['id'], issue_number=self.issue['number']), extra_environ=env, ) # click the edit link response = response.click(linkid='issue-edit-link', extra_environ=env) # fill in the form form = response.forms['issue-edit'] form['title'] = 'edited title' form['description'] = 'edited description' # save the form response = helpers.webtest_submit(form, 'save', extra_environ=env) response = response.follow() # make sure it all worked assert_in('edited title', response) assert_in('edited description', response) result = helpers.call_action('issue_show', dataset_id=self.dataset['id'], issue_number=self.issue['number']) assert_equals(u'edited title', result['title']) assert_equals(u'edited description', result['description'])
def test_after_each_step_is_executed_before_each_step(): "terrain.before.each_step and terrain.after.each_step decorators" world.step_states = [] @before.each_step def set_state_to_before(step): world.step_states.append('before') expected = 'Given I append "during" to states' if step.sentence != expected: raise TypeError('%r != %r' % (step.sentence, expected)) @step('append "during" to states') def append_during_to_step_states(step): world.step_states.append("during") @after.each_step def set_state_to_after(step): world.step_states.append('after') expected = 'Given I append "during" to states' if step.sentence != expected: raise TypeError('%r != %r' % (step.sentence, expected)) feature = Feature.from_string(FEATURE1) feature.run() assert_equals(world.step_states, ['before', 'during', 'after'])
def test_listing_save_adds_itself_to_relevant_zsets(self): list_all_publishables_in_category_by_hour(self) ct_id = self.publishables[0].content_type_id tools.assert_equals(set([ 'listing:1', 'listing:2', 'listing:3', 'listing:c:1', 'listing:c:2', 'listing:c:3', 'listing:d:1', 'listing:d:2', 'listing:d:3', 'listing:a:%d' % self.author.pk, 'listing:ct:%d' % ct_id, ]), set(self.redis.keys()) ) tools.assert_equals(['%d:1' % ct_id, '%d:2' % ct_id, '%d:3' % ct_id], self.redis.zrange('listing:a:1', 0, 100))
def test_get_many_objects(self): ct_ct = ContentType.objects.get_for_model(ContentType) site_ct = ContentType.objects.get_for_model(Site) objs = utils.get_cached_objects([(ct_ct.id, ct_ct.id), (ct_ct.id, site_ct.id), (site_ct.id, 1)]) tools.assert_equals([ct_ct, site_ct, Site.objects.get(pk=1)], objs)
def test_delete_keyword_undo(self): new_kw_name = 'Jiihaa' self._exec(AddKeyword(new_kw_name)) self._exec(RemoveMacro(self._new_keyword)) self._new_keyword = None self._exec(Undo()) assert_equals(self._new_keyword.name, new_kw_name)
def test_create_object_from_doc(self): new_object = provider_batch_data.create_objects_from_doc(self.old_doc) matching = ProviderBatchData.query.filter_by(provider="pmc").first() assert_equals(matching.provider, "pmc") assert_equals(matching.aliases, self.old_doc["aliases"])
def test_get_test_router(): with setting(TEST_RAPIDSMS_ROUTER='rapidsms.tests.router.test_base.BadClassName'): assert_raises(ImproperlyConfigured, get_test_router) with setting(TEST_RAPIDSMS_ROUTER='rapidsms.tests.router.bad_module.MockRouter'): assert_raises(ImproperlyConfigured, get_test_router) with setting(TEST_RAPIDSMS_ROUTER='rapidsms.tests.router.test_base.MockRouter'): assert_equals(get_test_router(), MockRouter)
def test_role_user_state3_perms(self): """ Testing user permission in state3. """ api_key = self.__login("user", "pass3") headers = self.__build_headers("user", api_key) test_author = Author.objects.create(id=100, name="dumb_name") set_state(test_author, self.state3) response = self.client.post("/admin-api/author/", data=self.new_author, content_type='application/json', **headers) tools.assert_equals(response.status_code, 201) response = self.client.get("/admin-api/author/100/", **headers) tools.assert_equals(response.status_code, 200) response = self.client.put("/admin-api/author/100/", data=self.new_author, content_type='application/json', **headers) tools.assert_equals(response.status_code, 401) response = self.client.patch("/admin-api/author/100/", data=self.new_author, content_type='application/json', **headers) tools.assert_equals(response.status_code, 401) response = self.client.delete("/admin-api/author/100/", **headers) tools.assert_equals(response.status_code, 401) self.__logout(headers)
def test_children_metaclass(): class HasChildren(object): __metaclass__ = ChildrenModelMetaclass has_children = True class WithoutChildren(object): __metaclass__ = ChildrenModelMetaclass class InheritedChildren(HasChildren): pass assert HasChildren.has_children assert not WithoutChildren.has_children assert InheritedChildren.has_children assert hasattr(HasChildren, 'children') assert not hasattr(WithoutChildren, 'children') assert hasattr(InheritedChildren, 'children') assert isinstance(HasChildren.children, List) assert_equals(Scope.children, HasChildren.children.scope) assert isinstance(InheritedChildren.children, List) assert_equals(Scope.children, InheritedChildren.children.scope)
def test_import_class(): assert_raises(ImproperlyConfigured, import_class, 'rapidsms.tests.router.test_base.BadClassName') assert_raises(ImproperlyConfigured, import_class, 'rapidsms.tests.router.bad_module.MockRouter') assert_equals(import_class('rapidsms.tests.router.test_base.MockRouter'), MockRouter)
def test_115(connpath): v = connect(connpath, await_params=True) # Dummy callback def mavlink_callback(*args): mavlink_callback.count += 1 mavlink_callback.count = 0 # Set the callback. v.set_mavlink_callback(mavlink_callback) # Change the vehicle into STABILIZE mode v.mode = VehicleMode("STABILIZE") # NOTE wait crudely for ACK on mode update time.sleep(3) # Expect the callback to have been called assert mavlink_callback.count > 0 # Unset the callback. v.unset_mavlink_callback() savecount = mavlink_callback.count # Disarm. A callback of None should not throw errors v.armed = False # NOTE wait crudely for ACK on mode update time.sleep(3) # Expect the callback to have been called assert_equals(savecount, mavlink_callback.count) # Re-arm should not throw errors. v.armed = True # NOTE wait crudely for ACK on mode update time.sleep(3)
def test_class_tags(): xblock = XBlock(None, None) assert_equals(xblock._class_tags, set()) class Sub1Block(XBlock): pass sub1block = Sub1Block(None, None) assert_equals(sub1block._class_tags, set()) @XBlock.tag("cat dog") class Sub2Block(Sub1Block): pass sub2block = Sub2Block(None, None) assert_equals(sub2block._class_tags, set(["cat", "dog"])) class Sub3Block(Sub2Block): pass sub3block = Sub3Block(None, None) assert_equals(sub3block._class_tags, set(["cat", "dog"])) @XBlock.tag("mixin") class MixinBlock(XBlock): pass class Sub4Block(MixinBlock, Sub3Block): pass sub4block = Sub4Block(None, None) assert_equals(sub4block._class_tags, set(["cat", "dog", "mixin"]))
def test_registered_classes_can_be_set_as_attrs(self): app_registry.register('dummy', DummyAppDataContainer) art = Article() art.app_data.dummy = {'answer': 42} tools.assert_true(isinstance(art.app_data.dummy, DummyAppDataContainer)) tools.assert_equals(DummyAppDataContainer(art, {'answer': 42}), art.app_data.dummy) tools.assert_equals({'dummy': {'answer': 42}}, art.app_data)
def test_serialize(self): """Objects are serialized to JSON-compatible objects""" def epoch(obj): """Convert to JS Epoch time""" return int(time.mktime(obj.timetuple())) * 1000 types = [('test', str, 'test'), (pd.Timestamp('2013-06-08'), int, epoch(pd.Timestamp('2013-06-08'))), (datetime.utcnow(), int, epoch(datetime.utcnow())), (1, int, 1), (1.0, float, 1.0), (np.float32(1), float, 1.0), (np.int32(1), int, 1), (np.float64(1), float, 1.0), (np.int64(1), int, 1)] for puts, pytype, gets in types: nt.assert_equal(Data.serialize(puts), gets) class BadType(object): """Bad object for type warning""" test_obj = BadType() with nt.assert_raises(LoadError) as err: Data.serialize(test_obj) nt.assert_equals(err.exception.message, 'cannot serialize index of type BadType')
def test_interro4(): print('Testing interrogation 4') corp = Corpus('data/test-stripped-tokenised') data = corp.interrogate({'n': 'any'}) d = {'and interrogating': {'first': 0, 'second': 2}, 'concordancing and': {'first': 0, 'second': 2}} assert_equals(data.results.to_dict(), d)
def test_formated_photo_from_master_format_is_used(self): master_format = Format.objects.create( name='sample', max_width=300, max_height=200, flexible_height=False, stretch=False, nocrop=False ) slave_format = Format.objects.create( name='slave', max_width=300, max_height=100, flexible_height=False, stretch=False, nocrop=False, master=master_format ) master_fp = FormatedPhoto(photo=self.photo, format=master_format) p2 = create_photo(self, color=(123, 123, 123), size=(300, 200)) p2.image.open() master_fp.image.save(p2.image.name, p2.image) master_fp.save() fp = FormatedPhoto(photo=self.photo, format=slave_format) fp.save() fp.image.open() i = Image.open(fp.image) tools.assert_equals((123, 123, 123), i.getpixel((10, 10))) tools.assert_equals((300, 100), i.size) p2.image.close()
def test_multi_set(self): params = { 'aa':1, 'bb':2, 'cc':3, 'dd':4, } a = self.client.multi_set(**params) assert_equals(a,4) b = self.client.get('aa') assert_equals(b,'1') b = self.client.get('bb') assert_equals(b,'2') b = self.client.get('cc') assert_equals(b,'3') b = self.client.get('dd') assert_equals(b,'4') d = self.client.delete('aa') assert_true(d) d = self.client.delete('bb') assert_true(d) d = self.client.delete('cc') assert_true(d) d = self.client.delete('dd') assert_true(d)
def test_bit(self): self.client.delete('bit_test') self.client.set('bit_test',1) a = self.client.countbit('bit_test') assert_equals(a,3) a = self.client.setbit('bit_test', 1, 1) assert_false(a) a = self.client.getbit('bit_test', 1) assert_true(a) b = self.client.get('bit_test') assert_equals(b,'3') c = self.client.setbit('bit_test', 2, 1) assert_false(c) b = self.client.get('bit_test') assert_equals(b,'7') c = self.client.setbit('bit_test', 2, 0) assert_true(c) c = self.client.getbit('bit_test', 2) assert_false(c) c = self.client.set('bit_test', '1234567890') c = self.client.countbit('bit_test', 0, 1) assert_equals(c,3) c = self.client.countbit('bit_test', 3, -3) assert_equals(c,16) f = self.client.delete('bit_test') assert_true(f)
def test_maxi_savings_account(): bank = Bank() checkingAccount = Account(MAXI_SAVINGS) bank.addCustomer(Customer("Bill").openAccount(checkingAccount)) year_behind = datetime.datetime.now() - datetime.timedelta(365) checkingAccount.deposit(3000.0, year_behind) assert_equals(bank.totalInterestPaid(), 150.0)
def test_indentation(): """Test correct indentation in groups""" count = 40 gotoutput = pretty.pretty(MyList(range(count))) expectedoutput = "MyList(\n" + ",\n".join(" %d" % i for i in range(count)) + ")" nt.assert_equals(gotoutput, expectedoutput)
def test_render_any_markup_formatting(): assert_equals(h.render_any_markup('README.md', '### foo\n' ' <script>alert(1)</script> bar'), '<div class="markdown_content"><h3 id="foo">foo</h3>\n' '<div class="codehilite"><pre><span class="nt">' '<script></span>alert(1)<span class="nt">' '</script></span> bar\n</pre></div>\n\n</div>')
def test_package_create(self): idf.plugin_v4.create_country_codes() result = helpers.call_action('package_create', name='test_package', custom_text='this is my custom text', country_code='uk') nt.assert_equals('this is my custom text', result['custom_text']) nt.assert_equals([u'uk'], result['country_code'])
def test_process_url_data_dir_exists(): base = '"/static/{data_dir}/file.png"'.format(data_dir=DATA_DIRECTORY) def processor(original, prefix, quote, rest): # pylint: disable=unused-argument,missing-docstring return quote + 'test' + rest + quote assert_equals(base, process_static_urls(base, processor, data_dir=DATA_DIRECTORY))
def test_storage_url_not_exists(mock_storage): mock_storage.exists.return_value = False mock_storage.url.return_value = '/static/data_dir/file.png' assert_equals('"/static/data_dir/file.png"', replace_static_urls(STATIC_SOURCE, DATA_DIRECTORY)) mock_storage.exists.assert_called_once_with('file.png') mock_storage.url.assert_called_once_with('data_dir/file.png')
def check_triangulation(embedding, expected_embedding): res_embedding, _ = triangulate_embedding(embedding, True) assert_equals(res_embedding.get_data(), expected_embedding, "Expected embedding incorrect") res_embedding, _ = triangulate_embedding(embedding, False) assert_equals(res_embedding.get_data(), expected_embedding, "Expected embedding incorrect")
def check_inheritable_attribute(self, attribute, value): # `attribute` isn't a basic attribute of Sequence assert_false(hasattr(SequenceDescriptor, attribute)) # `attribute` is added by InheritanceMixin assert_true(hasattr(InheritanceMixin, attribute)) root = SequenceFactory.build(policy={attribute: str(value)}) ProblemFactory.build(parent=root) # InheritanceMixin will be used when processing the XML assert_in(InheritanceMixin, root.xblock_mixins) seq = self.process_xml(root) assert_equals(seq.unmixed_class, SequenceDescriptor) assert_not_equals(type(seq), SequenceDescriptor) # `attribute` is added to the constructed sequence, because # it's in the InheritanceMixin assert_equals(value, getattr(seq, attribute)) # `attribute` is a known attribute, so we shouldn't include it # in xml_attributes assert_not_in(attribute, seq.xml_attributes)
def test_autocall_binops(): """See https://github.com/ipython/ipython/issues/81""" ip.magic('autocall 2') f = lambda x: x ip.user_ns['f'] = f try: yield nt.assert_equals(ip.prefilter('f 1'),'f(1)') for t in ['f +1', 'f -1']: yield nt.assert_equals(ip.prefilter(t), t) # Run tests again with a more permissive exclude_regexp, which will # allow transformation of binary operations ('f -1' -> 'f(-1)'). pm = ip.prefilter_manager ac = AutocallChecker(shell=pm.shell, prefilter_manager=pm, config=pm.config) try: ac.priority = 1 ac.exclude_regexp = r'^[,&^\|\*/]|^is |^not |^in |^and |^or ' pm.sort_checkers() yield nt.assert_equals(ip.prefilter('f -1'), 'f(-1)') yield nt.assert_equals(ip.prefilter('f +1'), 'f(+1)') finally: pm.unregister_checker(ac) finally: ip.magic('autocall 0') del ip.user_ns['f']
def test_magic_finds_SQLContext_and_passes_query(): ip.user_ns["sqlcon"] = sqlcon query = 'SHOW TABLES' result = ip.run_line_magic('sparksql', query) assert (isinstance(result, DataFrame)) assert_equals(query, sqlcon.queries[0])
def test_declined_call(self): marie = CoreManager('marie_rc') pauline = CoreManager('pauline_rc') out_call = pauline.lc.invite_address(marie.identity) assert_equals( CoreManager.wait_for( pauline, marie, lambda pauline, marie: marie.stats. number_of_LinphoneCallIncomingReceived == 1), True) in_call = marie.lc.current_call assert in_call is not None if in_call is not None: marie.lc.terminate_call(in_call) assert_equals( CoreManager.wait_for( pauline, marie, lambda pauline, marie: marie.stats. number_of_LinphoneCallReleased == 1), True) assert_equals( CoreManager.wait_for( pauline, marie, lambda pauline, marie: pauline.stats. number_of_LinphoneCallReleased == 1), True) assert_equals(marie.stats.number_of_LinphoneCallEnd, 1) assert_equals(pauline.stats.number_of_LinphoneCallEnd, 1) assert_equals(in_call.reason, linphone.Reason.Declined) assert_equals(out_call.reason, linphone.Reason.Declined)
def test_simple_call(self): marie = CoreManager('marie_rc') pauline = CoreManager('pauline_rc') assert_equals(CoreManager.call(pauline, marie), True) #liblinphone_tester_check_rtcp(marie,pauline); CoreManager.end_call(marie, pauline)
def test_caseinsensitivedict_creation(): "Test case insensitivity after creation" test_dict = CaseInsensitiveDict({'MiXeD': 1, 'lower': 2, 'UPPER': 3}) assert_equals(1, test_dict['mixed']) assert_equals(1, test_dict['MIXED']) assert_equals(1, test_dict['MIXed']) assert_equals(2, test_dict['lower']) assert_equals(2, test_dict['LOWER']) assert_equals(2, test_dict['LOWer']) assert_equals(3, test_dict['upper']) assert_equals(3, test_dict['UPPER']) assert_equals(3, test_dict['UPPer'])
def test_arguments_are_returned(self): kw_ctrl = file_controller().create_keyword('Keyword it is') dlg = UserKeywordNameDialog(kw_ctrl) assert_equals(dlg.get_args(), '')
def test_creation(self): kw_ctrl = file_controller().create_keyword('Keyword it is') dlg = UserKeywordNameDialog(kw_ctrl) assert_equals(dlg.get_name(), '')
def test_creation(self): test_ctrl = file_controller().create_test('A test') dlg = TestCaseNameDialog(test_ctrl) assert_equals(dlg.get_name(), '')
def test_get_entity_id(): entity = (1, 'name', []) assert_equals(1, get_entity_id(entity))
def it_replaces_company_name_with_customer_name_if_not_present(): xero_contact = Contact(recurly_contact) assert_equals(xero_contact.name, u"Tést Testérson")
def test_get_alias_text(): alias = entity_alias('alias', 'lang', False, 123) assert_equals('alias', get_alias_text(alias))
def it_should_translate_new_account_in_to_contact_object(): xero_contact = Contact(recurly_contact) assert_equals(xero_contact.number, "3-test-20120424T152301") assert_equals(xero_contact.first_name, u"Tést") assert_equals(xero_contact.last_name, u"Testérson") assert_equals(xero_contact.email, "*****@*****.**")
def it_should_output_xero_contact_xml(): xero_contact = Contact(recurly_contact) xero_contact.get_address() xero_xml = xero_contact.to_xml() doc = etree.fromstring(xero_xml) assert len(doc) > 0 assert_equals( doc.xpath("//Contact/ContactNumber")[0].text, "3-test-20120424T152301") assert_equals(doc.xpath("//Contact/Name")[0].text, u"Tést Testérson") assert_equals(doc.xpath("//Contact/FirstName")[0].text, u"Tést") assert_equals(doc.xpath("//Contact/LastName")[0].text, u"Testérson") assert_equals( doc.xpath("//Contact/EmailAddress")[0].text, "*****@*****.**") assert_equals( doc.xpath("//Address/AddressLine1")[0].text, "ScraperWiki Limited") assert_equals( doc.xpath("//Address/AddressLine2")[0].text, "146 Brownlow Hill") assert_equals(doc.xpath("//Address/City")[0].text, "Liverpool") assert_equals(doc.xpath("//Address/Region")[0].text, "MERSEYSIDE") assert_equals(doc.xpath("//Address/Country")[0].text, "GB") assert_equals(doc.xpath("//Address/PostalCode")[0].text, "L3 5RF")
def test_reset_results_in_subsequent_404(): "Expect a 404 after resetting the client" http_mock.reset() response = fake_client.post(url='/fred/test/one', ) assert_equals(response.status, 404)
def it_should_contact_recurly_to_get_further_contact_details(): xero_contact = Contact(recurly_contact) xero_contact.get_address() assert_equals(xero_contact.address1, "ScraperWiki Limited") assert_equals(xero_contact.address2, "146 Brownlow Hill") assert_equals(xero_contact.city, "Liverpool") assert_equals(xero_contact.state, "MERSEYSIDE") assert_equals(xero_contact.country, "GB") assert_equals(xero_contact.zip, "L3 5RF") assert_equals(xero_contact.vat_number, "123456")
def test_method_matching(): "Test that server matches methods correctly." http_mock.reset() http_mock.when('GET /test_get').reply(b'You tested a get', 200) http_mock.when('POST /test_post').reply(b'You tested a post', 201) http_mock.when('.* /test_star').reply(b'You tested a .*', 202) http_mock.when('.* /test_star').reply(b'You tested a .*', 202) http_mock.when('(PUT|POST) /test_put_or_post').reply( b'You tested a PUT or a POST', 203) # Only GET works when GET matched assert_equals(404, fake_client.post(url="/test_get").status) assert_equals(200, fake_client.get(url="/test_get").status) assert_equals(404, fake_client.get(url="/test_get").status) # Only POST works when POST matched assert_equals(404, fake_client.get(url="/test_post").status) assert_equals(201, fake_client.post(url="/test_post").status) assert_equals(404, fake_client.post(url="/test_post").status) # Any method works with .* as the method matched assert_equals(202, fake_client.get(url="/test_star").status) assert_equals(202, fake_client.post(url="/test_star").status) assert_equals(404, fake_client.post(url="/test_star").status) # PUT or POST work with (PUT|POST) as the method matched assert_equals(404, fake_client.get(url="/test_put_or_post").status) assert_equals(203, fake_client.post(url="/test_put_or_post").status) assert_equals(404, fake_client.post(url="/test_put_or_post").status)
def test_not_greater(self): class DateForm(Form): start_date = BetterDateTimeField( validators=[NotGreater('end_date')]) end_date = BetterDateTimeField() class NumberForm(Form): start = IntegerField(validators=[NotGreater('end')]) end = IntegerField() class MixedForm(Form): start = IntegerField(validators=[NotGreater('end')]) end = StringField() form = DateForm(start_date=thirty_days_ago(), end_date=today()) assert_equals(form.validate(), True) form = DateForm(start_date=today(), end_date=thirty_days_ago()) assert_equals(form.validate(), False) form = NumberForm(start=1, end=2) assert_equals(form.validate(), True) form = NumberForm(start=3, end=2) assert_equals(form.validate(), False) form = NumberForm(start=3, end=3) assert_equals(form.validate(), True) form = MixedForm(start=3, end='abc') assert_equals(form.validate(), False)
def test_welcome_view(self, sreq_mock, json_mock, rreq_mock): resp = self.app.get('/welcome') nt.assert_equals(resp.status_int, 200)
def test_missing_method_and_url_matches_anything(): "Missing matcher headers match anything" http_mock.reset() http_mock.reply(b'Hello', 323) response = fake_client.post(url='/some/strange/12121/string') assert_equals(response.status, 323)
def test_login_view(self): resp = self.app.get('/login') nt.assert_equals(resp.status_int, 200)
def test1(self): """r2 does not verify the formula.""" assert_equals(self.hierarchy.check_all_ancestors("g2"), {'g1': { 'f1': "['r2']" }})
def test_registration_view(self): resp = self.app.get('/register') nt.assert_equals(resp.status_int, 200)
def test_user_logins_successfully(self, resp_mock, json_mock, req_mock): resp = self.app.post('/login') nt.assert_equals(resp.status_int, 302)
def test_less_than(): """TEST 7.7: Implementing (< ...)""" assert_equals("#t", interpret('(< 1 2)', env)) assert_equals("#f", interpret('(< 2 2)', env)) assert_equals("#f", interpret('(< 2 1)', env))
def test_user_registers_successfully(self, request_mock): resp = self.app.post('/register') nt.assert_equals(resp.status_int, 302)
def test_greater_or_equal(): """TEST 7.5: Implementing (>= ...)""" assert_equals("#f", interpret('(>= 1 2)', env)) assert_equals("#t", interpret('(>= 2 2)', env)) assert_equals("#t", interpret('(>= 2 1)', env))
def test_index_view(self): resp = self.app.get('/') nt.assert_equals(resp.status_int, 200)
def test_and(): """TEST 7.3: Implementing (and ...)""" assert_equals("#f", interpret('(and #f #f)', env)) assert_equals("#f", interpret('(and #t #f)', env)) assert_equals("#f", interpret('(and #f #t)', env)) assert_equals("#t", interpret('(and #t #t)', env))
def test_less_or_equal(): """TEST 7.6: Implementing (<= ...)""" assert_equals("#t", interpret('(<= 1 2)', env)) assert_equals("#t", interpret('(<= 2 2)', env)) assert_equals("#f", interpret('(<= 2 1)', env))
def test_not(): """TEST 7.1: Implementing (not ...)""" assert_equals("#t", interpret('(not #f)', env)) assert_equals("#f", interpret('(not #t)', env))
def test_xor(): """TEST 7.4: Implementing (xor ...)""" assert_equals("#f", interpret('(xor #f #f)', env)) assert_equals("#t", interpret('(xor #t #f)', env)) assert_equals("#t", interpret('(xor #f #t)', env)) assert_equals("#f", interpret('(xor #t #t)', env))