@@ -606,3 +606,46 @@ def test_copy_into_memory(self, clear_fsspec_memory_cache):
606606 target = target_dir / "file1.txt"
607607 assert target .exists ()
608608 assert target .read_text () == content
609+
610+ def test_move_local (self , tmp_path : Path ):
611+ target = UPath (tmp_path ) / "target-file1.txt"
612+
613+ source = self .path / "file1.txt"
614+ content = source .read_text ()
615+ source .move (target )
616+ assert target .exists ()
617+ assert target .read_text () == content
618+ assert not source .exists ()
619+
620+ def test_move_into_local (self , tmp_path : Path ):
621+ target_dir = UPath (tmp_path ) / "target-dir"
622+ target_dir .mkdir ()
623+
624+ source = self .path / "file1.txt"
625+ content = source .read_text ()
626+ source .move_into (target_dir )
627+ target = target_dir / "file1.txt"
628+ assert target .exists ()
629+ assert target .read_text () == content
630+ assert not source .exists ()
631+
632+ def test_move_memory (self , clear_fsspec_memory_cache ):
633+ target = UPath ("memory:///target-file1.txt" )
634+ source = self .path / "file1.txt"
635+ content = source .read_text ()
636+ source .move (target )
637+ assert target .exists ()
638+ assert target .read_text () == content
639+ assert not source .exists ()
640+
641+ def test_move_into_memory (self , clear_fsspec_memory_cache ):
642+ target_dir = UPath ("memory:///target-dir" )
643+ target_dir .mkdir ()
644+
645+ source = self .path / "file1.txt"
646+ content = source .read_text ()
647+ source .move_into (target_dir )
648+ target = target_dir / "file1.txt"
649+ assert target .exists ()
650+ assert target .read_text () == content
651+ assert not source .exists ()
0 commit comments