def _MatchSingleFacetRefinement(self, doc_facet, refinement):
    if refinement.has_value():
      if refinement.has_range():
        raise ValueError('Refinement request for facet %s should either '
                         'specify range or value constraint, '
                         'not both.' % refinement.name())
      facet_value = doc_facet.value().string_value()
      if doc_facet.value().type() == document_pb.FacetValue.NUMBER:
        return float(facet_value) == float(refinement.value())
      else:
        return facet_value == refinement.value()
    if not refinement.has_range():
      raise ValueError('Refinement request for facet %s should specify '
                       'range or value constraint.' % refinement.name())


    if doc_facet.value().type() != document_pb.FacetValue.NUMBER:
      return False
    facet_value = float(doc_facet.value().string_value())
    ref_range = refinement.range()
    start = float(ref_range.start()) if ref_range.has_start() else None
    end = float(ref_range.end()) if ref_range.has_end() else None
    return ((start is None or facet_value >= start) and
            (end is None or facet_value < end))
When the cluster state includes no datasets, the endpoint
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/api/search/stub/simple_facet.py/SimpleFacet._MatchSingleFacetRefinement--crossover with--dataset/ETHPy150Open ClusterHQ/flocker/flocker/control/test/test_httpapi.py/DatasetsStateTestsMixin.test_empty