Código fuente para test.geo.test_debug
import unittest
from catatom2osm.app import QgsSingleton
from catatom2osm.geo.debug import DebugWriter
from catatom2osm.geo.layer.base import BaseLayer
from catatom2osm.geo.layer.highway import HighwayLayer
from catatom2osm.geo.point import Point
qgs = QgsSingleton()
[documentos]class TestDebugWriter(unittest.TestCase):
[documentos] def tearDown(self):
BaseLayer.delete_shp("test")
[documentos] def test_init(self):
layer = HighwayLayer()
db = DebugWriter("test", layer, "memory")
self.assertEqual(db.fields[0].name(), "note")
self.assertEqual(db.writer.hasError(), 0)
[documentos] def test_add_point(self):
layer = HighwayLayer()
db = DebugWriter("test", layer, "memory")
db.add_point(Point(0, 0), "foobar")
db.add_point(Point(0, 0))