File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,10 @@ def __eq__(self, other):
1515 return (hasattr (other , 'code_data' ) and
1616 other .code_data == self .code_data )
1717
18+ def __hash__ (self ):
19+ """Return hash based on remote object id."""
20+ return self .code_data .__hash__ ()
21+
1822
1923class RemoteMap (object ):
2024
Original file line number Diff line number Diff line change @@ -124,3 +124,17 @@ def test_tabpages():
124124 vim .current .tabpage = vim .tabpages [1 ]
125125 eq (vim .tabpages [1 ], vim .current .tabpage )
126126 eq (vim .windows [1 ], vim .current .window )
127+
128+
129+ @with_setup (setup = cleanup )
130+ def test_hash ():
131+ d = {}
132+ d [vim .current .buffer ] = "alpha"
133+ eq (d [vim .current .buffer ], "alpha" )
134+ vim .command ('new' )
135+ d [vim .current .buffer ] = "beta"
136+ eq (d [vim .current .buffer ], "beta" )
137+ vim .command ('winc w' )
138+ eq (d [vim .current .buffer ], "alpha" )
139+ vim .command ('winc w' )
140+ eq (d [vim .current .buffer ], "beta" )
You can’t perform that action at this time.
0 commit comments