def test_html(self): exp_size = 892 response = HttpResponse() exporter = export.HTMLExporter(self.concepts) template = Template(html_table) it = exporter.read(self.query) exporter.write(it, buff=response, template=template) self.assertAlmostEqual(len(response.content), exp_size, delta=delta)
def test_html(self): exporter = export.HTMLExporter(self.concepts) response = HttpResponse() template = Template("""<table> {% for row in rows %} <tr> {% for item in row %} <td>{{ item.values|join:" " }}</td> {% endfor %} </tr> {% endfor %} </table>""") exporter.write(self.query, template=template, buff=response) self.assertEqual(len(response.content), 494)
def test_html(self): name = 'export.html' exp_size = 892 template = Template(html_table) exporter = export.HTMLExporter(self.concepts) it = exporter.read(self.query) exporter.write(it, buff=name, template=template) size = os.path.getsize(name) self.assertAlmostEqual(size, exp_size, delta=delta) os.remove(name)
def test_html(self): exporter = export.HTMLExporter(self.concepts) template = Template("""<table> {% for row in rows %} <tr> {% for item in row %} <td>{{ item.values|join:" " }}</td> {% endfor %} </tr> {% endfor %} </table>""") buff = exporter.write(self.query, template=template) buff.seek(0) self.assertEqual(len(buff.read()), 494)