def test_multiple_choice(self): t = models.Test(type=models.MULTIPLE_CHOICE, choices="foo,bar,baz") tol = models.Tolerance(type=models.MULTIPLE_CHOICE, mc_tol_choices="foo", mc_pass_choices="") result = qa_tags.reference_tolerance_span(t, None, tol) self.assertIn("Tolerance Values", result)
def create_test( name=None, test_type=models.SIMPLE, choices=None, procedure=None, constant_value=None, category=None, wrap_low=None, wrap_high=None, ): user = create_user() if name is None or models.Test.objects.filter(name=name).count() > 0: name = "test_%d" % models.Test.objects.count() test = models.Test( name=name, slug=name, description="desc", type=test_type, category=category or create_category(), created_by=user, modified_by=user, choices=choices, wrap_high=wrap_high, wrap_low=wrap_low, procedure=procedure, constant_value=constant_value ) test.save() return test
def test_absolute(self): t = models.Test(type=models.NUMERICAL) r = models.Reference(value=1) tol = models.Tolerance( type=models.ABSOLUTE, act_low=-2, tol_low=-1, tol_high=1, act_high=2, ) result = qa_tags.reference_tolerance_span(t, r, tol) self.assertIn("%s L" % (settings.TEST_STATUS_DISPLAY_SHORT['action']), result)
def test_absolute(self): t = models.Test(type=models.NUMERICAL) r = models.Reference(value=1) tol = models.Tolerance( type=models.ABSOLUTE, act_low=-2, tol_low=-1, tol_high=1, act_high=2, ) result = qa_tags.reference_tolerance_span(t, r, tol) self.assertIn("ACT L", result)
def test_percent(self): t = models.Test(type=models.NUMERICAL) r = models.Reference(value=1) tol = models.Tolerance( type=models.PERCENT, act_low=-2, tol_low=-1, tol_high=1, act_high=2, ) result = qa_tags.reference_tolerance_span(t, r, tol) self.assertIn("(-2.00%", result)
def create_test(name=None, test_type=models.SIMPLE): user = create_user() if name is None or models.Test.objects.filter(name=name).count() > 0: name = "test%d" % models.Test.objects.count() test = models.Test( name=name, slug=name, description="desc", type=test_type, category=create_category(), created_by=user, modified_by=user, ) test.save() return test
def test_no_tol(self): t = models.Test(type=models.NUMERICAL) r = models.Reference(value=1) result = qa_tags.reference_tolerance_span(t, r, None) self.assertIn("No Tolerance", result)
def test_bool(self): t = models.Test(type=models.BOOLEAN) r = models.Reference(value=1) self.assertIn("Passing value", qa_tags.reference_tolerance_span(t, r, None))
def test_no_ref_no_tol(self): t = models.Test(type=models.MULTIPLE_CHOICE) self.assertIn("No Tol", qa_tags.reference_tolerance_span(t, None, None))
def test_no_ref(self): t = models.Test(type=models.BOOLEAN) self.assertIn("No Ref", qa_tags.reference_tolerance_span(t, None, None))