Did I find the right examples for you? yes no

All Samples(16)  |  Call(16)  |  Derive(0)  |  Import(0)
Returns the minimum value of the input.  Ignores unknown values, if
no values found besides unknown it will just return 'None'

Inputs:
  - value_type - one of integer, float, string, timestap
  - dictionary or list of string values
Outputs:
  - the single minimum value of the appropriate type

Test Coverage:(more...)

        def get_min(value_type, values):
    """ Returns the minimum value of the input.  Ignores unknown values, if
        no values found besides unknown it will just return 'None'

        Inputs:
          - value_type - one of integer, float, string, timestap
          - dictionary or list of string values
        Outputs:
          - the single minimum value of the appropriate type

        Test Coverage:
          - complete via test harness

    """
    assert value_type in ['integer', 'float', 'string', 'timestamp', 'unknown', None]

    known_vals = []
    for val in values:
        if not typer.is_unknown(val):
            try:
                if value_type == 'integer':
                    known_vals.append(int(val))
                elif value_type == 'float':
                    known_vals.append(float(val))
                else:
                    known_vals.append(val)
            except ValueError:
                pass                       # ignore invalid values

    # next return the minimum value
    try:
        return str(min(known_vals))
    except ValueError:
        return None
        


src/d/a/datagristle-0.56/gristle/field_determinator.py   datagristle(Download)
            self.field_max[f_no]    = miscer.get_max(self.field_types[f_no],
                                              self.field_freqs[f_no])
            self.field_min[f_no]    = miscer.get_min(self.field_types[f_no],
                                              self.field_freqs[f_no])
 

src/d/a/DataGristle-HEAD/gristle/field_determinator.py   DataGristle(Download)
            self.field_max[f_no]    = miscer.get_max(self.field_types[f_no],
                                              self.field_freqs[f_no])
            self.field_min[f_no]    = miscer.get_min(self.field_types[f_no],
                                              self.field_freqs[f_no])
 

src/d/a/datagristle-0.56/gristle/tests/test_field_misc.py   datagristle(Download)
    def test_misc_d01_emptiness(self):
        assert mod.get_max('string', self.empty_dict) is None
        assert mod.get_max('string', self.empty_list) is None
        assert mod.get_min('string', self.empty_dict) is None
        assert mod.get_min('string', self.empty_list) is None
 
    def test_misc_d02_easy_dict(self):
        assert mod.get_max('string', self.easy_dict)  == 'Wyoming'
        assert mod.get_min('string', self.easy_dict)  == 'Nevada'
    def test_misc_d03_easy_list(self):
        assert mod.get_max('string', self.easy_list)  == 'Wyoming'
        assert mod.get_min('string', self.easy_list)  == 'Nevada'
 
    def test_misc_d04_unknowns(self):
        assert mod.get_max('string', self.unk_list)  == 'Texas'
        assert mod.get_max('string', self.unk_dict)  == 'Texas'
        assert mod.get_min('string', self.unk_dict)  == 'Nevada'

src/d/a/DataGristle-HEAD/gristle/tests/test_field_misc.py   DataGristle(Download)
    def test_misc_d01_emptiness(self):
        assert mod.get_max('string', self.empty_dict) is None
        assert mod.get_max('string', self.empty_list) is None
        assert mod.get_min('string', self.empty_dict) is None
        assert mod.get_min('string', self.empty_list) is None
 
    def test_misc_d02_easy_dict(self):
        assert mod.get_max('string', self.easy_dict)  == 'Wyoming'
        assert mod.get_min('string', self.easy_dict)  == 'Nevada'
    def test_misc_d03_easy_list(self):
        assert mod.get_max('string', self.easy_list)  == 'Wyoming'
        assert mod.get_min('string', self.easy_list)  == 'Nevada'
 
    def test_misc_d04_unknowns(self):
        assert mod.get_max('string', self.unk_list)  == 'Texas'
        assert mod.get_max('string', self.unk_dict)  == 'Texas'
        assert mod.get_min('string', self.unk_dict)  == 'Nevada'