77import  pytest 
88
99from  dda .utils .fs  import  Path 
10- from  dda .utils .git .changeset  import  ChangeSet ,  ChangeType ,  FileChanges 
10+ from  dda .utils .git .changeset  import  ChangedFile ,  ChangeSet ,  ChangeType 
1111from  tests .tools .git .conftest  import  REPO_TESTCASES 
1212
1313
1414class  TestFileChangesClass :
1515    def  test_basic (self ):
16-         file_changes  =  FileChanges (file = Path ("/path/to/file" ), type = ChangeType .ADDED , patch = "patch" )
16+         file_changes  =  ChangedFile (file = Path ("/path/to/file" ), type = ChangeType .ADDED , patch = "patch" )
1717        assert  file_changes .file  ==  Path ("/path/to/file" )
1818        assert  file_changes .type  ==  ChangeType .ADDED 
1919        assert  file_changes .patch  ==  "patch" 
@@ -37,7 +37,7 @@ def test_generate_from_diff_output(self, repo_testcase):
3737            key = lambda  x : x .file .as_posix (),
3838        )
3939
40-         seen_filechanges  =  sorted (FileChanges .generate_from_diff_output (diff_output ), key = lambda  x : x .file .as_posix ())
40+         seen_filechanges  =  sorted (ChangedFile .generate_from_diff_output (diff_output ), key = lambda  x : x .file .as_posix ())
4141
4242        assert  len (seen_filechanges ) ==  len (expected_filechanges )
4343        for  seen , expected  in  zip (seen_filechanges , expected_filechanges , strict = True ):
@@ -46,39 +46,39 @@ def test_generate_from_diff_output(self, repo_testcase):
4646            assert  seen .patch  ==  expected .patch 
4747
4848    def  test_encode_decode (self ):
49-         file_changes  =  FileChanges (file = Path ("/path/to/file" ), type = ChangeType .ADDED , patch = "patch" )
50-         encoded_file_changes  =  msgspec .json .encode (file_changes , enc_hook = FileChanges .enc_hook )
49+         file_changes  =  ChangedFile (file = Path ("/path/to/file" ), type = ChangeType .ADDED , patch = "patch" )
50+         encoded_file_changes  =  msgspec .json .encode (file_changes , enc_hook = ChangedFile .enc_hook )
5151        decoded_file_changes  =  msgspec .json .decode (
52-             encoded_file_changes , type = FileChanges , dec_hook = FileChanges .dec_hook 
52+             encoded_file_changes , type = ChangedFile , dec_hook = ChangedFile .dec_hook 
5353        )
5454        assert  decoded_file_changes  ==  file_changes 
5555
5656
5757class  TestChangeSetClass :
5858    def  test_basic (self ):
59-         change  =  FileChanges (file = Path ("/path/to/file" ), type = ChangeType .ADDED , patch = "patch" )
59+         change  =  ChangedFile (file = Path ("/path/to/file" ), type = ChangeType .ADDED , patch = "patch" )
6060        changeset  =  ChangeSet ({change .file : change })
6161        assert  changeset [Path ("/path/to/file" )] ==  change 
6262
6363    def  test_add (self ):
64-         change  =  FileChanges (file = Path ("/path/to/file" ), type = ChangeType .ADDED , patch = "patch" )
64+         change  =  ChangedFile (file = Path ("/path/to/file" ), type = ChangeType .ADDED , patch = "patch" )
6565        changeset  =  ChangeSet .from_iter ([change ])
6666        assert  changeset [Path ("/path/to/file" )] ==  change 
6767
6868    def  test_digest (self ):
6969        changes  =  [
70-             FileChanges (file = Path ("/path/to/file" ), type = ChangeType .ADDED , patch = "patch" ),
71-             FileChanges (file = Path ("file2" ), type = ChangeType .MODIFIED , patch = "patch2" ),
72-             FileChanges (file = Path ("/path/../file3" ), type = ChangeType .DELETED , patch = "patch3" ),
70+             ChangedFile (file = Path ("/path/to/file" ), type = ChangeType .ADDED , patch = "patch" ),
71+             ChangedFile (file = Path ("file2" ), type = ChangeType .MODIFIED , patch = "patch2" ),
72+             ChangedFile (file = Path ("/path/../file3" ), type = ChangeType .DELETED , patch = "patch3" ),
7373        ]
7474        changeset  =  ChangeSet .from_iter (changes )
7575        assert  changeset .digest () ==  "95a9fe4d808bdda19da9285b6d1a31a6e29ddbfa" 
7676
7777    def  test_properties (self ):
7878        changes  =  [
79-             FileChanges (file = Path ("/path/to/file" ), type = ChangeType .ADDED , patch = "patch" ),
80-             FileChanges (file = Path ("file2" ), type = ChangeType .MODIFIED , patch = "patch2" ),
81-             FileChanges (file = Path ("/path/../file3" ), type = ChangeType .DELETED , patch = "patch3" ),
79+             ChangedFile (file = Path ("/path/to/file" ), type = ChangeType .ADDED , patch = "patch" ),
80+             ChangedFile (file = Path ("file2" ), type = ChangeType .MODIFIED , patch = "patch2" ),
81+             ChangedFile (file = Path ("/path/../file3" ), type = ChangeType .DELETED , patch = "patch3" ),
8282        ]
8383        changeset  =  ChangeSet .from_iter (changes )
8484        assert  changeset .added  ==  {Path ("/path/to/file" )}
@@ -111,9 +111,9 @@ def test_generate_from_diff_output(self, repo_testcase):
111111
112112    def  test_encode_decode (self ):
113113        changes  =  [
114-             FileChanges (file = Path ("/path/to/file" ), type = ChangeType .ADDED , patch = "patch" ),
115-             FileChanges (file = Path ("file2" ), type = ChangeType .MODIFIED , patch = "patch2" ),
116-             FileChanges (file = Path ("/path/../file3" ), type = ChangeType .DELETED , patch = "patch3" ),
114+             ChangedFile (file = Path ("/path/to/file" ), type = ChangeType .ADDED , patch = "patch" ),
115+             ChangedFile (file = Path ("file2" ), type = ChangeType .MODIFIED , patch = "patch2" ),
116+             ChangedFile (file = Path ("/path/../file3" ), type = ChangeType .DELETED , patch = "patch3" ),
117117        ]
118118        changeset  =  ChangeSet .from_iter (changes )
119119        encoded_changeset  =  msgspec .json .encode (changeset , enc_hook = ChangeSet .enc_hook )
0 commit comments