def run(testname): ''' run tests with fixtures ''' if inspect.isclass(testname): testname = testname.__name__ print() print(testname) print() print('-' * 70) print() runmodule(argv=['', '--logging-level=INFO', '-v'], exit=False)
other thing ''', [Node('blockquote', Node('p', Node('span', 'thing '))), Node('p', Node('span', 'other thing'))]) def test_double_underline_passthrough(self): self._helper('__', [Node('p', '__')]) def test_double_asterisk__passthrough(self): self._helper('**', [Node('p', '**')]) def test_null_indent(self): self._helper('\n\t', []) def test_null_indent_blockquoted(self): self._helper('>\t', [Node('blockquote')]) def test_empty_paragraph(self): self._helper('\n\t\n\n', []) def test_tokenizer(self): self.assertEquals(self.parser.tokenize("A *BOLD* thing"), [Token('TEXT', 'A '), Token('STAR', '*'), Token('TEXT', 'BOLD'), Token('ITEMSTAR', '* '), Token('TEXT', 'thing'),]) if __name__ == '__main__': try: from nose.core import runmodule except ImportError: print("Usage: nosetests test") else: runmodule()
def test_301_sources(self): ''' Return specified fields ''' res = self.query(q='__all__', fields='_id,info') for hit in res['hits']: assert '_id' in hit and 'info' in hit assert '_meta' not in hit def test_302_size(self): ''' Return specified size ''' res = self.query(q='__all__', size=6) eq_(len(res['hits']), 6) def test_303_raw(self): ''' Return raw ES result ''' res = self.query(q='__all__', raw=1) assert '_shards' in res def test_304_query(self): ''' Return query sent to ES ''' res = self.request('query?q=__all__&rawquery=1').json() assert "query" in res assert "bool" in res["query"] if __name__ == '__main__': print() print('SmartAPI Remote Test:', SmartAPIRemoteTest.host) print('-' * 70 + '\n') runmodule(argv=['', '--logging-level=INFO', '-v'])
requestObj = requestCls() requestObj.setAttr('parasObj', parasObj) requestObj.setAttr('obsEconomy', obsEconomy) requestObj.setAttr('derived', derived) requestObj.setAttr('single', True) requestObj.setAttr('optimization', optimization) requestObj.lock() ''' Call optimization. ''' optimize(requestObj) ''' Check results. ''' rslt = readStep('fval') if (fval is None): fval = rslt assert_true(np.allclose(fval, -165.628510699) == True) ''' Execution of module as script. ''' if __name__ == '__main__': runmodule()
def test_301_sources(self): ''' Return specified fields ''' res = self.query(q='__all__', fields='_id,info') for hit in res['hits']: assert '_id' in hit and 'info' in hit assert '_meta' not in hit def test_302_size(self): ''' Return specified size ''' res = self.query(q='__all__', size=6) eq_(len(res['hits']), 6) def test_303_raw(self): ''' Return raw ES result ''' res = self.query(q='__all__', raw=1) assert '_shards' in res def test_304_query(self): ''' Return query sent to ES ''' res = self.request('query?q=__all__&rawquery=1').json() assert "query" in res assert "bool" in res["query"] if __name__ == '__main__': print() print('SmartAPI Remote Test:', SmartAPIRemoteTest.host) print('-'*70 + '\n') runmodule(argv=['', '--logging-level=INFO', '-v'])