<commit_before># -*- coding: utf-8 -*-
import unittest
import os
import swc2vtk


class TestVtkGenerator(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        pass

    @classmethod
    def tearDownClass(cls):
        pass

    def setUp(self):
        self.swc_file_path = os.path.join('tests', 'simple.swc')
        self.data_file_path = os.path.join('tests', 'simple.dat')
        self.output_file_path = os.path.join('output.vtk')
        self.vtk_generator = swc2vtk.VtkGenerator()

    def tearDown(self):
        self.vtk_generator.write_vtk(self.output_file_path)

    def test_add_cylinder(self):
        self.vtk_generator.add_cylinder()

    def test_add_sphere(self):
        self.vtk_generator.add_sphere()

    def test_add_swc(self):
        simple_cmp_size = 11
        self.vtk_generator.add_swc(self.swc_file_path)
        self.assertEqual(simple_cmp_size, len(self.vtk_generator.swc_list[0].data))

    def test_add_swc_flip(self):
        simple_cmp_size = 11
        self.vtk_generator.add_swc(self.swc_file_path, inv_x=True, inv_y=True, inv_z=True,
                                   shift_x=100, shift_y=100, shift_z=100)
        self.assertEqual(simple_cmp_size, len(self.vtk_generator.swc_list[0].data))

    def test_add_datafile(self):
        simple_cmp_size = 11
        self.vtk_generator.add_swc(self.swc_file_path)
        self.vtk_generator.add_datafile(self.data_file_path)
        self.assertEqual(simple_cmp_size, len(self.vtk_generator.swc_list[0].data))

    def test_draw_mode1(self):
        self.vtk_generator.set_draw_mode(1)
        self.vtk_generator.add_swc(self.swc_file_path)

    def test_draw_mode2(self):
        self.vtk_generator.set_draw_mode(2)
        self.vtk_generator.add_swc(self.swc_file_path)

    def test_draw_mode3(self):
        self.vtk_generator.set_draw_mode(3)
        self.vtk_generator.add_swc(self.swc_file_path)

    def test_draw_mode4(self):
        self.vtk_generator.set_draw_mode(4)
        self.vtk_generator.add_swc(self.swc_file_path)

    def test_write_vtk_options(self):
        self.vtk_generator.add_swc(self.swc_file_path)
        self.vtk_generator.write_vtk(self.output_file_path, fixval=True, movingval=True, coloring=True,
                                     diam_ratio=0.2, normalize_diam=True, radius_data=True)


def suite():
    suite = unittest.TestSuite()
    suite.addTests(unittest.makeSuite(TestVtkGenerator))
    return suite


if __name__ == '__main__':
    unittest.main()<commit_msg>add test for volume rendering<commit_after># -*- coding: utf-8 -*-
import unittest
import os
import swc2vtk


class TestVtkGenerator(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        pass

    @classmethod
    def tearDownClass(cls):
        pass

    def setUp(self):
        self.swc_file_path = os.path.join('tests', 'simple.swc')
        self.data_file_path = os.path.join('tests', 'simple.dat')
        self.output_file_path = os.path.join('output.vtk')
        self.vtk_generator = swc2vtk.VtkGenerator()

    def tearDown(self):
        self.vtk_generator.write_vtk(self.output_file_path)

    def test_add_cylinder(self):
        self.vtk_generator.add_cylinder()

    def test_add_sphere(self):
        self.vtk_generator.add_sphere()

    def test_add_swc(self):
        simple_cmp_size = 11
        self.vtk_generator.add_swc(self.swc_file_path)
        self.assertEqual(simple_cmp_size, len(self.vtk_generator.swc_list[0].data))

    def test_add_swc_flip(self):
        simple_cmp_size = 11
        self.vtk_generator.add_swc(self.swc_file_path, inv_x=True, inv_y=True, inv_z=True,
                                   shift_x=100, shift_y=100, shift_z=100)
        self.assertEqual(simple_cmp_size, len(self.vtk_generator.swc_list[0].data))

    def test_add_datafile(self):
        simple_cmp_size = 11
        self.vtk_generator.add_swc(self.swc_file_path)
        self.vtk_generator.add_datafile(self.data_file_path)
        self.assertEqual(simple_cmp_size, len(self.vtk_generator.swc_list[0].data))

    def test_draw_mode1(self):
        self.vtk_generator.set_draw_mode(1)
        self.vtk_generator.add_swc(self.swc_file_path)

    def test_draw_mode2(self):
        self.vtk_generator.set_draw_mode(2)
        self.vtk_generator.add_swc(self.swc_file_path)

    def test_draw_mode3(self):
        self.vtk_generator.set_draw_mode(3)
        self.vtk_generator.add_swc(self.swc_file_path)

    def test_draw_mode4(self):
        self.vtk_generator.set_draw_mode(4)
        self.vtk_generator.add_swc(self.swc_file_path)

    def test_write_vtk_options(self):
        self.vtk_generator.add_swc(self.swc_file_path)
        self.vtk_generator.write_vtk(self.output_file_path, fixval=True, movingval=True, coloring=True,
                                     diam_ratio=0.2, normalize_diam=True, radius_data=True)

    def test_write_volume_vtk(self):
        self.vtk_generator.add_swc(self.swc_file_path)
        self.vtk_generator.write_volume_vtk(self.output_file_path, origin=(-100, -100, -100), ratio=(4.0, 4.0, 4.0))


def suite():
    suite = unittest.TestSuite()
    suite.addTests(unittest.makeSuite(TestVtkGenerator))
    return suite


if __name__ == '__main__':
    unittest.main()
{'fraction_non_alphanumeric': 0.10489109667558273, 'fraction_numerical': 0.014711501719526175, 'mean_word_length': 3.1947115384615383, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5419267', 'n_tokens_mistral': 1972, 'n_tokens_neox': 1894, 'n_words': 223}