Exemplo n.º 1
0
Arquivo: Range.py Projeto: lepy/Ranger
    def atMost(val):
        """ Makes range including all values less than or equal to
        some value (i.e. (-inf, val])

        Parameters
        ----------
        val : comparable
            The upper bound

        Raises
        ------
        ValueError
            If type not comparable

        Returns
        -------
        A Range object (-inf, val]
        """
        Range._validate_cutpoints(val)
        theType = Range._get_type(val)
        return Range(Cut.belowAll(theType=theType),
                     Cut.aboveValue(val, theType=theType))
Exemplo n.º 2
0
def range_all(theType):
    """Create a range than contains every value of the given type."""
    return Range(
        Cut.belowAll(theType=theType),
        Cut.aboveAll(theType=theType))
Exemplo n.º 3
0
def range_all(theType: Any) -> Range:
    """Create a range than contains every value of the given type."""
    return Range(Cut.belowAll(theType=theType), Cut.aboveAll(theType=theType))
Exemplo n.º 4
0
 def test_belowAll(self):
     if debug: print("Testing belowAll")
     theCut = Cut.belowAll(int)
     self.assertTrue(theCut.belowAll)
     self.assertFalse(theCut.aboveAll)
     self.assertIsNone(theCut.point)
Exemplo n.º 5
0
 def test_belowAll(self):
     if debug: print("Testing belowAll")
     theCut = Cut.belowAll(int)
     self.assertTrue(theCut.belowAll)
     self.assertFalse(theCut.aboveAll)
     self.assertIsNone(theCut.point)