File tree Expand file tree Collapse file tree 4 files changed +44
-0
lines changed Expand file tree Collapse file tree 4 files changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ class MyClass :
2
+ def __init__ (self , x : int ) -> None :
3
+ self .x = x
4
+
5
+ # TODO: Fix the type hints of `copy` to make it type check
6
+ def copy (self ) -> MyClass :
7
+ copied_object = MyClass (x = self .x )
8
+ return copied_object
9
+
10
+
11
+ ## End of your code ##
12
+
13
+ from typing import assert_type
14
+
15
+ inst = MyClass (x = 1 )
16
+ assert_type (inst .copy (), MyClass )
Original file line number Diff line number Diff line change
1
+ class MyClass :
2
+ def __init__ (self , x : int ) -> None :
3
+ self .x = x
4
+
5
+ # TODO: Fix the type hints of `copy` to make it type check
6
+ def copy (self ) -> "MyClass" :
7
+ copied_object = MyClass (x = self .x )
8
+ return copied_object
9
+
10
+
11
+ ## End of your code ##
12
+
13
+ from typing import assert_type
14
+
15
+ inst = MyClass (x = 1 )
16
+ assert_type (inst .copy (), MyClass )
Original file line number Diff line number Diff line change 3
3
4
4
def stop () -> Never :
5
5
"""TODO: implement this function to make it type check"""
6
+
7
+
8
+ ## End of your code ##
9
+ from typing import assert_never
10
+
11
+ assert_never (stop ())
Original file line number Diff line number Diff line change 4
4
def stop () -> Never :
5
5
"""TODO: implement this function to make it type check"""
6
6
raise RuntimeError ("" )
7
+
8
+
9
+ ## End of your code ##
10
+ from typing import assert_never
11
+
12
+ assert_never (stop ())
You can’t perform that action at this time.
0 commit comments