code: def test_readlines_data(self):
      # Test that emulating a file that ends in a newline character works
      mock = mock_open(read_data="foo\nbar\nbaz\n")
      with patch("%s.open" % __name__, mock, create=True):
          h = open("bar")
          result = h.readlines()
      self.assertEqual(result, ["foo\n", "bar\n", "baz\n"])
  
      # Test that files without a final newline will also be correctly
      # emulated
      mock = mock_open(read_data="foo\nbar\nbaz")
      with patch("%s.open" % __name__, mock, create=True):
          h = open("bar")
          result = h.readlines()
  
      self.assertEqual(result, ["foo\n", "bar\n", "baz"])
  
imports: import unittest
  from warnings import catch_warnings
  from test.test_unittest.testmock.support import is_instance
  from unittest.mock import MagicMock, Mock, patch, sentinel, mock_open, call
label_desc: Use image node_id 9 for calling the TestMockOpen obj's underlying member method code with example usage: obj.test_readlines_data() without return types