class_docstr: Checks all functions of the GitCodeDriver
class_docstr_tok: ["Checks","all","functions","of","the","GitCodeDriver"]
code: def test_checkout_ref(self):
      # TODO: Test remote checkout
      self.git_code_manager.init()
      test_filepath = os.path.join(
          self.git_code_manager.filepath, "test.txt"
      )
      with open(test_filepath, "wb") as f:
          f.write(to_bytes(str("test1")))
      # Create first ref
      ref_id_1 = self.git_code_manager.create_ref()
      with open(test_filepath, "wb") as f:
          f.write(to_bytes(str("test2")))
      # Add random file to .datmo directory before next ref
      os.makedirs(
          os.path.join(self.git_code_manager.filepath, ".datmo")
      )
      random_filepath = os.path.join(
          self.git_code_manager.filepath, ".datmo", ".test"
      )
      with open(random_filepath, "wb") as f:
          f.write(to_bytes(str("test")))
      # Check to make sure .datmo/.test exists and has contents
      assert (
          os.path.isfile(random_filepath)
          and "test" in open(random_filepath, "r").read()
      )
      # Create second ref
      ref_id_2 = self.git_code_manager.create_ref()
      # Checkout to previous ref, .datmo should be unaffected
      result = self.git_code_manager.checkout_ref(ref_id_1)
  
      # Check code was properly checked out
      assert ref_id_1 != ref_id_2
      assert (
          result == True
          and self.git_code_manager.latest_commit() == ref_id_1
      )
      # Check to make sure .datmo is not affected
      assert (
          os.path.isfile(random_filepath)
          and "test" in open(random_filepath, "r").read()
      )
  
imports: from __future__ import division
  from __future__ import unicode_literals
  import os
  import time
  import shutil
  import tempfile
  import platform
  from io import open
  from datmo.core.controller.code.driver.git import GitCodeDriver, GitHostDriver
  from datmo.core.util.exceptions import CommitFailed, CommitDoesNotExist, PathDoesNotExist, GitExecutionError, DatmoFolderInWorkTree, UnstagedChanges
label_desc: Use image node_id 18 for calling the TestGitCodeDriver obj's underlying member method code with example usage: obj.test_checkout_ref() without return types