def test_sentence(self): words = Words() sentence = words.sentence() assert sentence print(sentence)
start, end, sentence = data self.send(self.server.format(''' <p class="sentence">{sentence!s}</p> <p class="date"><span class="epoch">{start!s}</span> — <span class="epoch">{end!s}</span>.</p> ''', start=start, end=end, sentence=sentence, title='Timestamp lookup')) def _current(self): start, end, sentence = latest_dict(self.server.sentences) if end: self._not_found() # current should have an open endpoint else: self.send(self.server.format(''' <p class="sentence"><a href="./?q={encoded!s}">{sentence!s}</a></p> ''', sentence=sentence, encoded=quote_plus(sentence), title='Current timestamp')) def _not_found(self): self.send_error(404) TEST_URL = 'http://localhost:8081' def test_static(): chdir('/home/andrew/project/wordstamp/git/static') static = HTTPServer(('0.0.0.0', 8081), SimpleHTTPRequestHandler) Thread(target=static.serve_forever).start() if __name__ == '__main__': test_static() words = Words() sentence = words.sentence() Server(8080, TEST_URL, OrderedDict([(key(sentence), (123456, None, sentence))]))()