예제 #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)
예제 #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
예제 #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)
예제 #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
예제 #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
예제 #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)
예제 #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)
예제 #8
0
 def setUp(self):
     self.dxfdict = DXFDictionaryWithDefault(
         ClassifiedTags.from_text(DEFAULT_DICT))
예제 #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
예제 #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)
예제 #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'))
예제 #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")
예제 #13
0
 def setUp(self):
     self.dxfdict = DXFDictionary(ClassifiedTags.from_text(EMPTY_DICT))
예제 #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)
예제 #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)
예제 #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)
예제 #17
0
 def setUp(self):
     self.xrecord = XRecord(ClassifiedTags.from_text(XRECORD1))