@@ -1250,20 +1250,40 @@ def test_padding_length_is_char_count_not_byte_count(self, dict_node, ast_adapte
12501250 class TestMissingLocationInfoTest :
12511251 SOURCE = 'abc = def'
12521252
1253- def test_get_source_segment_returns_none (self , ast_adapter ):
1253+ def test_get_source_segment_returns_none_without_location (self , ast_adapter ):
12541254 node = ast .Module (body = [], type_ignores = [])
12551255 assert not hasattr (node , 'lineno' )
12561256 assert not hasattr (node , 'col_offset' )
12571257
12581258 assert ast_adapter .get_source_segment (node ) is None
12591259
1260- def test_get_source_region_returns_none (self , ast_adapter ):
1260+ def test_get_source_region_returns_none_without_location (self , ast_adapter ):
12611261 node = ast .Module (body = [], type_ignores = [])
12621262 assert not hasattr (node , 'lineno' )
12631263 assert not hasattr (node , 'col_offset' )
12641264
12651265 assert ast_adapter [node ] == (None , None )
12661266
1267+ def test_get_source_segment_returns_none_without_end_location (self , ast_adapter ):
1268+ node = ast .Add (
1269+ lineno = 1 ,
1270+ col_offset = 1 ,
1271+ end_lineno = None ,
1272+ end_col_offset = None ,
1273+ )
1274+
1275+ assert ast_adapter .get_source_segment (node ) is None
1276+
1277+ def test_get_source_region_returns_none_without_end_location (self , ast_adapter ):
1278+ node = ast .Add (
1279+ lineno = 1 ,
1280+ col_offset = 1 ,
1281+ end_lineno = None ,
1282+ end_col_offset = None ,
1283+ )
1284+
1285+ assert ast_adapter [node ] == (None , None )
1286+
12671287 class TestRegionOffset :
12681288 SOURCE = textwrap .dedent (
12691289 """
0 commit comments