Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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
Exemple #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)
Exemple #6
0
 def setUp(self):
     self.tags = ClassifiedTags.from_text(MESH)
     self.mesh = Mesh(self.tags, DWG)
Exemple #7
0
 def setUp(self):
     tags = ClassifiedTags.from_text(_HATCH_TPL)
     self.hatch = Hatch(tags)
Exemple #8
0
 def setUp(self):
     tags = ClassifiedTags.from_text(PATH_HATCH)
     self.hatch = Hatch(tags)
Exemple #9
0
 def setUp(self):
     tags = ClassifiedTags.from_text(HATCH_PATTERN)
     self.hatch = Hatch(tags)
Exemple #10
0
 def setUp(self):
     self.spline = Spline(ClassifiedTags.from_text(_SPLINE_TPL))
Exemple #11
0
 def setUp(self):
     self.tags = ClassifiedTags.from_text(SPECIALCASE_TEXT)
 def setUp(self):
     self.tags = ClassifiedTags.from_text(SPECIALCASE_TEXT)
Exemple #13
0
 def setUp(self):
     tags = ClassifiedTags.from_text(HATCH_PATTERN)
     self.hatch = Hatch(tags)
Exemple #14
0
 def setUp(self):
     tags = ClassifiedTags.from_text(EDGE_HATCH_WITH_SPLINE)
     self.hatch = Hatch(tags)
Exemple #15
0
 def setUp(self):
     self.entity = AttributeChecker(ClassifiedTags.from_text(XTEMPLATE))
Exemple #16
0
 def setUp(self):
     tags = ClassifiedTags.from_text(PATH_HATCH)
     self.hatch = Hatch(tags)
 def setUp(self):
     self.xtags = ClassifiedTags.from_text(XTAGS1)
Exemple #18
0
 def setUp(self):
     tags = ClassifiedTags.from_text(_HATCH_TPL)
     self.hatch = Hatch(tags)
Exemple #19
0
 def setUp(self):
     self.xtags = ClassifiedTags.from_text(XTAGS1)
Exemple #20
0
 def setUp(self):
     tags = ClassifiedTags.from_text(EDGE_HATCH_WITH_SPLINE)
     self.hatch = Hatch(tags)
Exemple #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))
Exemple #22
0
 def setUp(self):
     self.entity = AttributeChecker(ClassifiedTags.from_text(XTEMPLATE))