Example #1
0
 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)
Example #2
0
 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
Example #3
0
 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)
Example #4
0
 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
Example #5
0
 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
Example #6
0
 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)
Example #7
0
 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)
Example #8
0
 def setUp(self):
     self.dxfdict = DXFDictionaryWithDefault(
         ClassifiedTags.from_text(DEFAULT_DICT))
Example #9
0
 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
Example #10
0
 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)
Example #11
0
 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'))
Example #12
0
 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")
Example #13
0
 def setUp(self):
     self.dxfdict = DXFDictionary(ClassifiedTags.from_text(EMPTY_DICT))
Example #14
0
 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)
Example #15
0
 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)
Example #16
0
 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)
Example #17
0
 def setUp(self):
     self.xrecord = XRecord(ClassifiedTags.from_text(XRECORD1))