docstr: `get_bytecode` caches its results.
docstr_tok: ["`","get_bytecode","`","caches","its","results","."]
code: def test_returns_cached_data(self, mock_open_python_file: Mock):
      """`get_bytecode` caches its results."""
      mock_open_python_file.side_effect = source_util.open_python_file
      cache = ScriptCache()
  
      # The first time we get a script's bytecode, the script is loaded from disk.
      result = cache.get_bytecode(_get_script_path("good_script.py"))
      self.assertIsNotNone(result)
      mock_open_python_file.assert_called_once()
  
      # Subsequent calls don't reload the script from disk and return the same object.
      mock_open_python_file.reset_mock()
      self.assertIs(
          cache.get_bytecode(_get_script_path("good_script.py")), result
      )
      mock_open_python_file.assert_not_called()
  
file_path: streamlit/lib/tests/streamlit/runtime/scriptrunner/script_cache_test.py
imports: import os.path
  import unittest
  from unittest import mock
  from unittest.mock import Mock
  from streamlit import source_util
  from streamlit.runtime.scriptrunner.script_cache import ScriptCache
label_desc: Use image node_id 2 for calling the ScriptCacheTest obj's underlying member method code with example usage: obj.test_returns_cached_data(mock_open_python_file) without return types