class_docstr: Object that can be used to control a number of feature flags for a
  given test run.
  
  This enables an approach to data generation called swarm testing (
  see Groce, Alex, et al. "Swarm testing." Proceedings of the 2012
  International Symposium on Software Testing and Analysis. ACM, 2012), in
  which generation is biased by selectively turning some features off for
  each test case generated. When there are many interacting features this can
  find bugs that a pure generation strategy would otherwise have missed.
  
  FeatureFlags are designed to "shrink open", so that during shrinking they
  become less restrictive. This allows us to potentially shrink to smaller
  test cases that were forbidden during the generation phase because they
  required disabled features.
class_docstr_tok: ["Object","that","can","be","used","to","control","a","number","of","feature","flags","for","a","given","test","run",".","This","enables","an","approach","to","data","generation","called","swarm","testing","(","see","Groce",",","Alex",",","et","al",".","``","Swarm","testing",".","''","Proceedings","of","the","2012","International","Symposium","on","Software","Testing","and","Analysis",".","ACM",",","2012",")",",","in","which","generation","is","biased","by","selectively","turning","some","features","off","for","each","test","case","generated",".","When","there","are","many","interacting","features","this","can","find","bugs","that","a","pure","generation","strategy","would","otherwise","have","missed",".","FeatureFlags","are","designed","to","``","shrink","open","''",",","so","that","during","shrinking","they","become","less","restrictive",".","This","allows","us","to","potentially","shrink","to","smaller","test","cases","that","were","forbidden","during","the","generation","phase","because","they","required","disabled","features","."]
docstr: Tests whether the feature named ``name`` should be enabled on this
  test run.
docstr_tok: ["Tests","whether","the","feature","named","``","name","``","should","be","enabled","on","this","test","run","."]
code: def is_enabled(self, name):
      """Tests whether the feature named ``name`` should be enabled on this
      test run."""
      if self.__data is None or self.__data.frozen:
          # Feature set objects might hang around after data generation has
          # finished. If this happens then we just report all new features as
          # enabled, because that's our shrinking direction and they have no
          # impact on data generation if they weren't used while it was
          # running.
          try:
              return self.__is_value_enabled(self.__decisions[name])
          except KeyError:
              return True
  
      data = self.__data
  
      data.start_example(label=FEATURE_LABEL)
      if name in self.__decisions:
          # If we've already decided on this feature then we don't actually
          # need to draw anything, but we do write the same decision to the
          # input stream. This allows us to lazily decide whether a feature
          # is enabled, because it means that if we happen to delete the part
          # of the test case where we originally decided, the next point at
          # which we make this decision just makes the decision it previously
          # made.
          value = self.__decisions[name]
          data.draw_bits(8, forced=value)
      else:
          # If the baseline is 0 then everything is enabled so it doesn't
          # matter what we have here and we might as well make the shrinker's
          # life easier by forcing it to zero.
          if self.__baseline == 0:
              value = 0
              data.draw_bits(8, forced=0)
          else:
              value = data.draw_bits(8)
          self.__decisions[name] = value
      data.stop_example()
      return self.__is_value_enabled(value)
  
file_path: catboost/contrib/python/hypothesis/py2/hypothesis/strategies/_internal/featureflags.py
imports: from __future__ import absolute_import, division, print_function
  import hypothesis.internal.conjecture.utils
  from hypothesis.strategies._internal.strategies import SearchStrategy
label_desc: Use image node_id 2 for calling the FeatureFlags obj's underlying member method code with example usage: obj.is_enabled(name) and returns: self, self, True