diff --git a/test/test_parsing.py b/test/test_parsing.py index d61a98ff..6d67499b 100644 --- a/test/test_parsing.py +++ b/test/test_parsing.py @@ -19,11 +19,15 @@ class TestCallAndName(): return stmt.get_commands()[0] def test_name_and_call_positions(self): - call = self.get_call('name\ncall, something_else') - name = call.name - assert str(name) == 'name' - assert name.start_pos == call.start_pos == (1, 0) - assert name.end_pos == call.end_pos == (1, 4) + call = self.get_call('name\nsomething_else') + assert str(call.name) == 'name' + assert call.name.start_pos == call.start_pos == (1, 0) + assert call.name.end_pos == call.end_pos == (1, 4) + + call = self.get_call('1.0\n') + assert call.name == 1.0 + assert call.name.start_pos == call.start_pos == (1, 0) + assert call.name.end_pos == call.end_pos == (1, 3) def test_call_type(self): call = self.get_call('hello') @@ -40,3 +44,16 @@ class TestCallAndName(): call = self.get_call('"hello"') assert call.type == pr.Call.STRING assert call.name == 'hello' + +def test_module(): + module = Parser('asdf', 'example.py', no_docstr=True).module + name = module.name + assert str(name) == 'example' + assert name.start_pos == (0, 0) + assert name.end_pos == (0, 0) + + module = Parser('asdf', no_docstr=True).module + name = module.name + assert str(name) == '' + assert name.start_pos == (0, 0) + assert name.end_pos == (0, 0)