code: def testBuildVersionFromEnvironment(self):
      # This test covers build-time construction of version strings in the
      # presence of several environment variables.
      base_version = "1.2.3"
  
      with jtu.set_env(
          JAX_RELEASE=None,
          JAXLIB_RELEASE=None,
          JAX_NIGHTLY=None,
          JAXLIB_NIGHTLY=None,
      ):
          with assert_subprocess_call():
              version = jax.version._get_version_for_build()
          # TODO(jakevdp): confirm that this includes a date string & commit hash?
          self.assertTrue(version.startswith(f"{base_version}.dev"))
          self.assertValidVersion(version)
  
      with jtu.set_env(
          JAX_RELEASE=None,
          JAXLIB_RELEASE=None,
          JAX_NIGHTLY="1",
          JAXLIB_NIGHTLY=None,
      ):
          with assert_no_subprocess_call():
              version = jax.version._get_version_for_build()
          datestring = datetime.date.today().strftime("%Y%m%d")
          self.assertEqual(version, f"{base_version}.dev{datestring}")
          self.assertValidVersion(version)
  
      with jtu.set_env(
          JAX_RELEASE=None,
          JAXLIB_RELEASE=None,
          JAX_NIGHTLY=None,
          JAXLIB_NIGHTLY="1",
      ):
          with assert_no_subprocess_call():
              version = jax.version._get_version_for_build()
          datestring = datetime.date.today().strftime("%Y%m%d")
          self.assertEqual(version, f"{base_version}.dev{datestring}")
          self.assertValidVersion(version)
  
      with jtu.set_env(
          JAX_RELEASE="1",
          JAXLIB_RELEASE=None,
          JAX_NIGHTLY=None,
          JAXLIB_NIGHTLY=None,
      ):
          with assert_no_subprocess_call():
              version = jax.version._get_version_for_build()
          self.assertEqual(version, base_version)
          self.assertValidVersion(version)
  
      with jtu.set_env(
          JAX_RELEASE=None,
          JAXLIB_RELEASE="1",
          JAX_NIGHTLY=None,
          JAXLIB_NIGHTLY=None,
      ):
          with assert_no_subprocess_call():
              version = jax.version._get_version_for_build()
          self.assertEqual(version, base_version)
          self.assertValidVersion(version)
  
imports: import contextlib
  import datetime
  import unittest
  from unittest import mock
  import re
  from absl.testing import absltest
  import jax
  from jax._src.lib import check_jaxlib_version
  from jax._src import test_util
label_desc: Use image node_id 6 for calling the JaxVersionTest obj's underlying member method code with example usage: obj.testBuildVersionFromEnvironment() without return types