Пример #1
0
 def test_numeric(self):
     """Test ordinal descriptors."""
     with self.assertRaises(ValidationError):
         desc = NumMolDescriptor(heading='heading',
                                 name='test descriptor',
                                 calculatorSoftware='test_suite',
                                 calculatorSoftwareVersion=0,
                                 maximum=3,
                                 minimum=5)
         desc.save()
Пример #2
0
 def test_numeric_ok(self):
     """Test a working numeric descriptor."""
     desc = NumMolDescriptor(
         heading='heading',
         name='test descriptor',
         calculatorSoftware = 'test_suite',
         calculatorSoftwareVersion=0,
         maximum=5,
         minimum=3)
     desc.save()
     desc.delete()
Пример #3
0
 def test_numeric_max_null(self):
     """Test creating a numeric descriptor with a null max value works."""
     desc = NumMolDescriptor(
         heading='heading',
         name='test descriptor',
         calculatorSoftware = 'test_suite',
         calculatorSoftwareVersion=0,
         maximum=None,
         minimum=3)
     desc.save()
     desc.delete()
Пример #4
0
 def test_numeric(self):
     """Test ordinal descriptors."""
     with self.assertRaises(ValidationError):
         desc = NumMolDescriptor(
             heading='heading',
             name='test descriptor',
             calculatorSoftware = 'test_suite',
             calculatorSoftwareVersion=0,
             maximum=3,
             minimum=5)
         desc.save()
Пример #5
0
 def test_numeric_min_null(self):
     """Test creating a numeric descriptor with a null min value works."""
     desc = NumMolDescriptor(
         heading='heading',
         name='test descriptor',
         calculatorSoftware = 'test_suite',
         calculatorSoftwareVersion=0,
         maximum=5,
         minimum=None)
     desc.save()
     descVal = NumMolDescriptorValue(
         compound=Compound.objects.get(abbrev='EtOH'),
         descriptor=desc,
         value=3)
     descVal.save()
     desc.delete()
Пример #6
0
 def test_numeric_max_null_toohigh(self):
     """Test creating a numeric descriptor with a null max value works."""
     desc = NumMolDescriptor(
         heading='heading',
         name='test descriptor',
         calculatorSoftware = 'test_suite',
         calculatorSoftwareVersion=0,
         maximum=5,
         minimum=None)
     desc.save()
     with self.assertRaises(ValidationError):
         descVal = NumMolDescriptorValue(
             compound=Compound.objects.get(abbrev='EtOH'),
             descriptor=desc,
             value=6)
         descVal.save()
     desc.delete()
Пример #7
0
 def test_numeric_loolow(self):
     """Test a descriptor value that is below the minimum."""
     desc = NumMolDescriptor(
         heading='heading',
         name='test descriptor',
         calculatorSoftware = 'test_suite',
         calculatorSoftwareVersion=0,
         maximum=5,
         minimum=3)
     desc.save()
     with self.assertRaises(ValidationError):
         descVal = NumMolDescriptorValue(
             compound=Compound.objects.get(abbrev='EtOH'),
             descriptor=desc,
             value=2)
         descVal.save()
     desc.delete()
Пример #8
0
 def test_numeric_ok(self):
     """Test a working numeric descriptor."""
     desc = NumMolDescriptor(
         heading='heading',
         name='test descriptor',
         calculatorSoftware = 'test_suite',
         calculatorSoftwareVersion=0,
         maximum=5,
         minimum=3)
     desc.save()
     descVal = NumMolDescriptorValue(
         compound=Compound.objects.get(abbrev='EtOH'),
         descriptor=desc,
         value=3)
     descVal.save()
     descVal.delete()
     desc.delete()
Пример #9
0
 def test_numeric_lims_null(self):
     """Test creating a numeric descriptor w/a null min, max value works."""
     desc = NumMolDescriptor(heading='heading',
                             name='test descriptor',
                             calculatorSoftware='test_suite',
                             calculatorSoftwareVersion=0,
                             maximum=None,
                             minimum=None)
     desc.save()
     desc.delete()
Пример #10
0
 def test_numeric_ok(self):
     """Test a working numeric descriptor."""
     desc = NumMolDescriptor(heading='heading',
                             name='test descriptor',
                             calculatorSoftware='test_suite',
                             calculatorSoftwareVersion=0,
                             maximum=5,
                             minimum=3)
     desc.save()
     desc.delete()
Пример #11
0
 def test_numeric_min_null(self):
     """Test creating a numeric descriptor with a null min value works."""
     desc = NumMolDescriptor(heading='heading',
                             name='test descriptor',
                             calculatorSoftware='test_suite',
                             calculatorSoftwareVersion=0,
                             maximum=5,
                             minimum=None)
     desc.save()
     descVal = NumMolDescriptorValue(
         compound=CompoundGuideEntry.objects.get(
             abbrev='EtOH', labGroup__title='Narnia').compound,
         descriptor=desc,
         value=3)
     descVal.save()
     desc.delete()
Пример #12
0
 def test_numeric_max_null_toolow(self):
     """Test creating a numeric descriptor with a null max value works."""
     desc = NumMolDescriptor(heading='heading',
                             name='test descriptor',
                             calculatorSoftware='test_suite',
                             calculatorSoftwareVersion=0,
                             maximum=None,
                             minimum=3)
     desc.save()
     with self.assertRaises(ValidationError):
         descVal = NumMolDescriptorValue(
             compound=CompoundGuideEntry.objects.get(
                 abbrev='EtOH', labGroup__title='Narnia').compound,
             descriptor=desc,
             value=2)
         descVal.save()
     desc.delete()
Пример #13
0
 def test_numeric_toohigh(self):
     """Test a descriptor value that is above the maximum."""
     desc = NumMolDescriptor(heading='heading',
                             name='test descriptor',
                             calculatorSoftware='test_suite',
                             calculatorSoftwareVersion=0,
                             maximum=5,
                             minimum=3)
     desc.save()
     with self.assertRaises(ValidationError):
         descVal = NumMolDescriptorValue(
             compound=CompoundGuideEntry.objects.get(
                 abbrev='EtOH', labGroup__title='Narnia').compound,
             descriptor=desc,
             value=6)
         descVal.save()
     desc.delete()