예제 #1
0
 def test_one_short_binary_chunk(self):
     tags = ClassifiedTags.from_text(BIN_ONE_SHORT)
     compress_binary_data(tags)
     ole2frame = tags.get_subclass('AcDbOle2Frame')
     compressed_tag = ole2frame[-1]  # last tag
     self.assertTrue(isinstance(compressed_tag, CompressedTags))
     self.assertEqual(310, compressed_tag.code)
     self.assertEqual(len(ole2frame), 10)
예제 #2
0
 def test_write_four_binary_chunks(self):
     tags = ClassifiedTags.from_text(BIN_FOUR)
     compress_binary_data(tags)
     stream = StringIO()
     tags.write(stream)
     result = stream.getvalue()
     stream.close()
     result_lines = [line.strip() for line in result.splitlines()]
     bin_four_lines = [line.strip() for line in BIN_FOUR.splitlines()]
     self.assertEqual(bin_four_lines, result_lines)
예제 #3
0
 def test_two_short_binary_chunks(self):
     tags = ClassifiedTags.from_text(BIN_TWO_SHORT)
     compress_binary_data(tags)
     ole2frame = tags.get_subclass('AcDbOle2Frame')
     compressed_tag_310 = ole2frame[-2]
     compressed_tag_311 = ole2frame[-1]
     self.assertTrue(isinstance(compressed_tag_310, CompressedTags))
     self.assertTrue(isinstance(compressed_tag_311, CompressedTags))
     self.assertEqual(310, compressed_tag_310.code)
     self.assertEqual(311, compressed_tag_311.code)
     self.assertEqual(len(ole2frame), 11)
예제 #4
0
 def test_one_long_binary_chunk(self):
     tags = ClassifiedTags.from_text(BIN_ONE_LONG)
     ole2frame = tags.get_subclass('AcDbOle2Frame')
     uncompressed_length = sum(
         len(tag.value) for tag in ole2frame if tag.code == 310)
     compress_binary_data(tags)
     compressed_tag = ole2frame[-1]  # last tag
     self.assertTrue(isinstance(compressed_tag, CompressedTags))
     compressed_length = len(compressed_tag.value._data)
     self.assertEqual(310, compressed_tag.code)
     self.assertEqual(len(ole2frame), 10)
     self.assertTrue(
         uncompressed_length / compressed_length > 4)  # ratio > 1:4
예제 #5
0
 def test_four_binary_chunks(self):
     tags = ClassifiedTags.from_text(BIN_FOUR)
     compress_binary_data(tags)
     ole2frame = tags.get_subclass('AcDbOle2Frame')
     compressed_tag_310 = ole2frame[-4]
     compressed_tag_311 = ole2frame[-3]
     compressed_tag_310_2 = ole2frame[-2]
     compressed_tag_312 = ole2frame[-1]
     self.assertTrue(isinstance(compressed_tag_310, CompressedTags))
     self.assertTrue(isinstance(compressed_tag_311, CompressedTags))
     self.assertTrue(isinstance(compressed_tag_310_2, CompressedTags))
     self.assertTrue(isinstance(compressed_tag_312, CompressedTags))
     self.assertEqual(310, compressed_tag_310.code)
     self.assertEqual(311, compressed_tag_311.code)
     self.assertEqual(310, compressed_tag_310_2.code)
     self.assertEqual(312, compressed_tag_312.code)
     self.assertEqual(len(ole2frame), 13)
예제 #6
0
파일: test_mesh.py 프로젝트: aka863/ezdxf
 def setUp(self):
     self.tags = ClassifiedTags.from_text(MESH)
     self.mesh = Mesh(self.tags, DWG)
예제 #7
0
 def setUp(self):
     tags = ClassifiedTags.from_text(_HATCH_TPL)
     self.hatch = Hatch(tags)
예제 #8
0
 def setUp(self):
     tags = ClassifiedTags.from_text(PATH_HATCH)
     self.hatch = Hatch(tags)
예제 #9
0
 def setUp(self):
     tags = ClassifiedTags.from_text(HATCH_PATTERN)
     self.hatch = Hatch(tags)
예제 #10
0
 def setUp(self):
     self.spline = Spline(ClassifiedTags.from_text(_SPLINE_TPL))
예제 #11
0
 def setUp(self):
     self.tags = ClassifiedTags.from_text(SPECIALCASE_TEXT)
예제 #12
0
 def setUp(self):
     self.tags = ClassifiedTags.from_text(SPECIALCASE_TEXT)
예제 #13
0
 def setUp(self):
     tags = ClassifiedTags.from_text(HATCH_PATTERN)
     self.hatch = Hatch(tags)
예제 #14
0
 def setUp(self):
     tags = ClassifiedTags.from_text(EDGE_HATCH_WITH_SPLINE)
     self.hatch = Hatch(tags)
예제 #15
0
 def setUp(self):
     self.entity = AttributeChecker(ClassifiedTags.from_text(XTEMPLATE))
예제 #16
0
 def setUp(self):
     tags = ClassifiedTags.from_text(PATH_HATCH)
     self.hatch = Hatch(tags)
예제 #17
0
 def setUp(self):
     self.xtags = ClassifiedTags.from_text(XTAGS1)
예제 #18
0
 def setUp(self):
     tags = ClassifiedTags.from_text(_HATCH_TPL)
     self.hatch = Hatch(tags)
예제 #19
0
 def setUp(self):
     self.xtags = ClassifiedTags.from_text(XTAGS1)
예제 #20
0
 def setUp(self):
     tags = ClassifiedTags.from_text(EDGE_HATCH_WITH_SPLINE)
     self.hatch = Hatch(tags)
예제 #21
0
 def test_init_with_tags(self):
     tags = Tags.from_text(XTAGS1)
     xtags = ClassifiedTags(tags)
     self.assertEqual(3, len(xtags.subclasses))
     self.assertEqual(1, len(xtags.xdata))
예제 #22
0
 def setUp(self):
     self.entity = AttributeChecker(ClassifiedTags.from_text(XTEMPLATE))