@@ -140,6 +140,7 @@ class TestRun(MypycDataSuite):
140140 optional_out = True
141141 multi_file = False
142142 separate = False # If True, using separate (incremental) compilation
143+ strict_dunder_typing = False
143144
144145 def run_case (self , testcase : DataDrivenTestCase ) -> None :
145146 # setup.py wants to be run from the root directory of the package, which we accommodate
@@ -232,7 +233,11 @@ def run_case_step(self, testcase: DataDrivenTestCase, incremental_step: int) ->
232233 groups = construct_groups (sources , separate , len (module_names ) > 1 )
233234
234235 try :
235- compiler_options = CompilerOptions (multi_file = self .multi_file , separate = self .separate )
236+ compiler_options = CompilerOptions (
237+ multi_file = self .multi_file ,
238+ separate = self .separate ,
239+ strict_dunder_typing = self .strict_dunder_typing ,
240+ )
236241 result = emitmodule .parse_and_typecheck (
237242 sources = sources ,
238243 options = options ,
@@ -401,6 +406,14 @@ class TestRunSeparate(TestRun):
401406 files = ["run-multimodule.test" , "run-mypy-sim.test" ]
402407
403408
409+ class TestRunStrictDunderTyping (TestRun ):
410+ """Run the tests with strict dunder typing."""
411+
412+ strict_dunder_typing = True
413+ test_name_suffix = "_dunder_typing"
414+ files = ["run-dunders.test" , "run-floats.test" ]
415+
416+
404417def fix_native_line_number (message : str , fnam : str , delta : int ) -> str :
405418 """Update code locations in test case output to point to the .test file.
406419
0 commit comments