Exemple #1
0
    def test_dot_not_root_changed(self):
        expected: str = f"{os.getcwd()}/{self.filename}"

        with opened('./', self.filename, extended=True, dot_root='.') as file:
            self.pretty_test_print(file.filepath, expected)

        os.remove(f"./{self.filename}")
Exemple #2
0
    def test_dot_dot_not_root_changed(self):
        with tempfile.TemporaryDirectory() as temporary_directory:
            expected: str = f"/private{temporary_directory[::-1].split('/', 1)[1][::-1][:-2]}/{self.filename}"

            with opened('../',
                        self.filename,
                        extended=True,
                        dot_root=temporary_directory) as file:
                self.pretty_test_print(file.filepath, expected)
Exemple #3
0
    def test_dot_subfolder_S(self):
        with tempfile.TemporaryDirectory() as temporary_directory:

            expected: str = f"/private{temporary_directory}/subfolder/{self.filename}"

            with opened('./subfolder/',
                        self.filename,
                        extended=True,
                        dot_root=temporary_directory) as file:
                self.pretty_test_print(file.filepath, expected)
Exemple #4
0
    def test_not_extended(self):
        with opened('./', f"{self.filename}-2", extended=False) as file:
            pass

        if os.path.isfile(f"./{self.filename}-2"):
            pass
        else:
            raise Exception(f"./{self.filename}-2 does not exist")

        os.remove(f"./{self.filename}-2")
        print(
            f"{colors.CYAN}Created and removed file {self.filename}-2{colors.ENDC} succesfully"
        )
Exemple #5
0
 def test_error_Unkown_String_Beginning(self):
     with tempfile.TemporaryDirectory() as temporary_directory:
         try:
             with opened(None,
                         self.filename,
                         extended=True,
                         dot_root=temporary_directory) as file:
                 pass
         except Exception:
             print(
                 textwrap.dedent(
                     f"{colors.CYAN}Error Raised Expectedly{colors.ENDC}"))
             return True