def test_get_2d_point(self): point = PointAccessor(ClassifiedTags.from_text("11\n1.0\n21\n2.0\n40\n3.0\n")) self.assertEqual((1., 2.), point.dxf.flat)
def test_error_get_2d_point_form_3d_point(self): point = PointAccessor(ClassifiedTags.from_text("11\n1.0\n21\n2.0\n31\n3.0\n")) with self.assertRaises(DXFStructureError): point.dxf.flat
def test_get_3d_point_shift(self): tags = ClassifiedTags.from_text("12\n1.0\n22\n2.0\n32\n3.0\n") point = PointAccessor(tags) self.assertEqual((1., 2., 3.), point.dxf.xp)
def test_error(self): tags = ClassifiedTags.from_text("12\n1.0\n22\n2.0\n32\n3.0\n") point = PointAccessor(tags) with self.assertRaises(ValueError): point.dxf.point
def test_error_get_2d_point_for_required_3d_point(self): tags = ClassifiedTags.from_text("10\n1.0\n20\n2.0\n 0\nVALUE\n") point = PointAccessor(tags) with self.assertRaises(DXFStructureError): point.dxf.point
def test_set_point(self): tags = ClassifiedTags.from_text("10\n1.0\n20\n2.0\n30\n3.0\n") point = PointAccessor(tags) point.dxf.point = (7, 8, 9) self.assertEqual(1, len(tags.noclass)) # points represented by just one tag since v0.6 (code, (x, y[, z])) self.assertEqual((7., 8., 9.), point.dxf.point)
def test_set_not_existing_3D_point_with_wrong_axis_count(self): tags = ClassifiedTags.from_text("70\n7\n10\n1.0\n20\n2.0\n30\n3.0\n") point = PointAccessor(tags) self.assertFalse(point.dxf_attrib_exists('xp')) with self.assertRaises(ValueError): point.dxf.xp = (7, 8)
def setUp(self): self.dxfdict = DXFDictionaryWithDefault( ClassifiedTags.from_text(DEFAULT_DICT))
def test_delete_not_supported_dxfattrib(self): tags = ClassifiedTags.from_text("70\n7\n10\n1.0\n20\n2.0\n30\n3.0\n") point = PointAccessor(tags) with self.assertRaises(AttributeError): del point.dxf.mozman
def test_set_not_existing_3D_point(self): tags = ClassifiedTags.from_text("70\n7\n10\n1.0\n20\n2.0\n30\n3.0\n") point = PointAccessor(tags) self.assertFalse(point.dxf_attrib_exists('xp')) point.dxf.xp = (7, 8, 9) self.assertEqual((7, 8, 9), point.dxf.xp)
def test_delete_simple_dxfattrib(self): tags = ClassifiedTags.from_text("70\n7\n10\n1.0\n20\n2.0\n30\n3.0\n") point = PointAccessor(tags) self.assertEqual(7, point.dxf.flags) del point.dxf.flags self.assertFalse(point.dxf_attrib_exists('flags'))
def test_get_dxfattrib_for_wrong_dxfversion_without_error(self): tags = ClassifiedTags.from_text("10\n1.0\n20\n2.0\n30\n3.0\n71\n999\n") point = PointAccessor(tags) self.assertEqual(999, point.dxf.just_AC1015, "If false tags are there, don't care")
def setUp(self): self.dxfdict = DXFDictionary(ClassifiedTags.from_text(EMPTY_DICT))
def test_set_2d_point(self): point = PointAccessor(ClassifiedTags.from_text("11\n1.0\n21\n2.0\n40\n3.0\n")) point.dxf.flat = (4, 5) self.assertEqual(2, len(point.tags.noclass)) # points represented by just one tag since v0.6 (code, (x, y[, z])) self.assertEqual((4., 5.), point.dxf.flat)
def test_set_not_existing_flex_point_as_2D(self): tags = ClassifiedTags.from_text("70\n7\n10\n1.0\n20\n2.0\n30\n3.0\n") point = PointAccessor(tags) self.assertFalse(point.dxf_attrib_exists('flex')) point.dxf.flex = (7, 8) self.assertEqual((7, 8), point.dxf.flex)
def test_get_3d_point(self): tags = ClassifiedTags.from_text("13\n1.0\n23\n2.0\n33\n3.0\n") point = PointAccessor(tags) self.assertEqual((1., 2., 3.), point.dxf.flex)
def setUp(self): self.xrecord = XRecord(ClassifiedTags.from_text(XRECORD1))