예제 #1
0
    def test_package_generation_namespace(self):
        to_python_package([FooRecord], self.tmp_path)
        src = self.get_file_content("my/foo/bar.py")
        expected_src = header_source() + "\n" + TestSourceConversion.correct
        self.assertEquals(src, expected_src)

        expected_output_files = {"my/foo/bar.py", "my/foo/__init__.py", "my/__init__.py", "__init__.py"}
        output_files = set()
        for root, dirs, files in os.walk(self.tmp_path):
            for f in files:
                rel_path = os.path.relpath(os.path.join(root, f), self.tmp_path)
                output_files.add(rel_path)

        self.assertEquals(output_files, expected_output_files)
예제 #2
0
    def test_package_generation_namespace(self):
        to_python_package([FooRecord], self.tmp_path)
        src = self.get_file_content("my/foo/bar.py")
        expected_src = header_source() + "\n" + TestSourceConversion.correct
        self.assertEquals(src, expected_src)

        expected_output_files = {
            'my/foo/bar.py', 'my/foo/__init__.py', 'my/__init__.py',
            '__init__.py'
        }
        output_files = set()
        for root, dirs, files in os.walk(self.tmp_path):
            for f in files:
                rel_path = os.path.relpath(os.path.join(root, f),
                                           self.tmp_path)
                output_files.add(rel_path)

        self.assertEquals(output_files, expected_output_files)
예제 #3
0
 def test_package_generation_no_namespace(self):
     to_python_package([Parent], self.tmp_path)
     src = self.get_file_content("__init__.py")
     expected_src = header_source() + "\n" + TestSubRecord.correct
     self.assertEquals(src, expected_src)
예제 #4
0
 def test_package_generation_no_namespace(self):
     to_python_package([Parent], self.tmp_path)
     src = self.get_file_content("__init__.py")
     expected_src = header_source() + "\n" + TestSubRecord.correct
     self.assertEquals(src, expected_src)