Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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
Beispiel #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)
Beispiel #6
0
 def setUp(self):
     self.entity = AttributeChecker(ClassifiedTags.from_text(XTEMPLATE))
Beispiel #7
0
 def setUp(self):
     tags = ClassifiedTags.from_text(_HATCH_TPL)
     self.hatch = Hatch(tags)
Beispiel #8
0
 def setUp(self):
     tags = ClassifiedTags.from_text(PATH_HATCH)
     self.hatch = Hatch(tags)
Beispiel #9
0
 def setUp(self):
     self.tags = ClassifiedTags.from_text(SPECIALCASE_TEXT)
Beispiel #10
0
 def setUp(self):
     self.viewport = Viewport(ClassifiedTags.from_text(_VPORT_TPL))
Beispiel #11
0
 def setUp(self):
     self.spline = Spline(ClassifiedTags.from_text(_SPLINE_TPL))
Beispiel #12
0
 def setUp(self):
     self.tags = ClassifiedTags.from_text(IMAGE)
     self.image = Image(self.tags, DWG)
Beispiel #13
0
 def setUp(self):
     self.tags = ClassifiedTags.from_text(IMAGE_DEF)
     self.image_def = ImageDef(self.tags, DWG)
Beispiel #14
0
 def test_join_subclasses(self):
     tags = ClassifiedTags.from_text(LEICA_DISTO_TAGS)
     join_subclasses(tags.subclasses)
     self.assertEqual(9, len(tags.noclass))
     self.assertEqual(1, len(tags.subclasses))
Beispiel #15
0
 def setUp(self):
     self.tags = ClassifiedTags.from_text(NO_REACTORS)
Beispiel #16
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))
Beispiel #17
0
 def setUp(self):
     tags = ClassifiedTags.from_text(EDGE_HATCH_WITH_SPLINE)
     self.hatch = Hatch(tags)
Beispiel #18
0
 def setUp(self):
     tags = ClassifiedTags.from_text(HATCH_PATTERN)
     self.hatch = Hatch(tags)
Beispiel #19
0
 def setUp(self):
     self.tags = ClassifiedTags.from_text(MESH)
     self.mesh = Mesh(self.tags, DWG)
Beispiel #20
0
 def setUp(self):
     self.xtags = ClassifiedTags.from_text(XTAGS1)