class TestDXF13Layer(unittest.TestCase): def setUp(self): tags = Tags.fromtext(DXF13LAYERS) self.layers = LayerTable(tags, DrawingProxy("AC1024")) def test_get_existing_layer(self): layer = self.layers.get("View Port") self.assertEqual("View Port", layer.name) def test_contains(self): self.assertTrue("View Port" in self.layers) self.assertTrue("0" in self.layers) self.assertTrue("Defpoints" in self.layers) def test_get_color(self): layer = self.layers.get("View Port") self.assertEqual(7, layer.color) def test_get_linetype(self): layer = self.layers.get("View Port") self.assertEqual("Continuous", layer.linetype) def test_not_existing_layer(self): with self.assertRaises(KeyError): layer = self.layers.get("LAYER-DOES-NOT-EXIST") def test_layernames(self): self.assertEqual(3, len(self.layers.layernames()))
class TestDXF12Layer(unittest.TestCase): def setUp(self): tags = Tags.fromtext(DXF12LAYERS) self.layers = LayerTable(tags, DrawingProxy("AC1009")) def test_get_existing_layer(self): layer = self.layers.get("VIEW_PORT") self.assertEqual("VIEW_PORT", layer.name) def test_contains(self): self.assertTrue("VIEW_PORT" in self.layers) self.assertTrue("0" in self.layers) self.assertTrue("DEFPOINTS" in self.layers) def test_get_color(self): layer = self.layers.get("VIEW_PORT") self.assertEqual(7, layer.color) def test_get_linetype(self): layer = self.layers.get("VIEW_PORT") self.assertEqual("CONTINUOUS", layer.linetype) def test_not_existing_layer(self): with self.assertRaises(KeyError): layer = self.layers.get("LAYER-DOES-NOT-EXIST") def test_layernames(self): self.assertEqual(3, len(self.layers.layernames()))