コード例 #1
0
    def testCollections(self):
        req = Requirement()
        self.assertIsNone(req.collections)

        req = Requirement(collections={'andrew'})
        self.assertEqual(len(req.collections), 1)
        self.assertEqual(req.collections, {'andrew'})
コード例 #2
0
    def testBase(self):
        r0 = Requirement()
        r1 = Requirement()
        r2 = Requirement()
        req = collections.OrderedDict(a=[r0, r1], b=[r2])

        number_requirements(req, 1980)
        self.assertEqual(r0.label, '1980.1.1')
        self.assertEqual(r1.label, '1980.1.2')
        self.assertEqual(r2.label, '1980.2.1')
コード例 #3
0
    def testTypes(self):
        req = Requirement()
        self.assertIsNone(req.types)

        req = Requirement(specification=TestSpecification(type='andrew'))
        self.assertEqual(len(req.types), 1)
        self.assertEqual(req.types, {'andrew'})

        req = Requirement(details=[Detail(specification=TestSpecification(type='andrew')),
                                   Detail(specification=TestSpecification(type='1980'))])
        self.assertEqual(len(req.types), 2)
        self.assertEqual(req.types, {'andrew', '1980'})
コード例 #4
0
    def testPrerequisites(self):
        req = Requirement()
        self.assertEqual(len(req.prerequisites), 0)

        req = Requirement(specification=TestSpecification(prerequisites={'andrew'}))
        self.assertEqual(len(req.prerequisites), 1)
        self.assertEqual(req.prerequisites, {'andrew'})

        req = Requirement(details=[Detail(specification=TestSpecification(prerequisites={'andrew'})),
                                   Detail(specification=TestSpecification(prerequisites={'1980'}))])
        self.assertEqual(len(req.prerequisites), 2)
        self.assertEqual(req.prerequisites, {'andrew', '1980'})
コード例 #5
0
    def testNames(self):
        req = Requirement()
        self.assertEqual(len(req.names), 0)

        req = Requirement(specification=TestSpecification(name='andrew'))
        self.assertEqual(len(req.names), 1)
        self.assertEqual(req.names, {'andrew'})

        req = Requirement(details=[Detail(specification=TestSpecification(name='andrew')),
                                   Detail(specification=TestSpecification(name='1980'))])
        self.assertEqual(len(req.names), 2)
        self.assertEqual(req.names, {'andrew', '1980'})
コード例 #6
0
    def testInit(self):
        kwargs = dict(name='name',
                      path='path',
                      filename='filename',
                      line=1,
                      label='label',
                      requirement='requirement',
                      requirement_line=2,
                      design=['design'],
                      design_line=3,
                      issues=['issues'],
                      issues_line=4,
                      details=['d0', 'd1'],
                      detail='detail',
                      detail_line=5,
                      deprecated=False,
                      deprecated_line=6,
                      duplicate=False,
                      verification=['v0', 'v1'],
                      verification_line=7,
                      validation=['v2', 'v3'],
                      validation_line=8,
                      prerequisites=set(['p0', 'p1']),
                      skip=False,
                      deleted=False)

        req = Requirement(**kwargs)
        for key, value in kwargs.items():
            attrib = getattr(req, key)
            self.assertEqual(attrib, value)
コード例 #7
0
 def testStr(self):
     s = str(
         Requirement(requirement='requirement',
                     design=['design'],
                     issues=['issues']))
     self.assertIn("Requirement: requirement", s)
     self.assertIn("Design: ['design']", s)
     self.assertIn("Issues: ['issues']", s)
コード例 #8
0
    def testTestable(self):
        req = Requirement()
        self.assertFalse(req.testable)

        req.specification = TestSpecification()
        self.assertTrue(req.testable)

        req.specification.skip = True
        self.assertFalse(req.testable)

        req.specification = None
        self.assertFalse(req.testable)
        req.details.append(Detail(specification=TestSpecification()))
        self.assertTrue(req.testable)

        req.details[0].specification.skip = True
        self.assertFalse(req.testable)
コード例 #9
0
ファイル: test_Requirement.py プロジェクト: yfzhang910/moose
 def testStr(self):
     s = str(
         Requirement(requirement='requirement',
                     design=['design'],
                     issues=['issues']))
     self.assertIn("requirement = 'requirement'", s)
     self.assertIn("design = ['design']", s)
     self.assertIn("issues = ['issues']", s)
コード例 #10
0
    def testTestable(self):
        req = Requirement()
        self.assertTrue(req.testable)

        req = Requirement(skip=True)
        self.assertFalse(req.testable)

        req = Requirement(deleted=True)
        self.assertFalse(req.testable)

        req = Requirement()
        req.details = [Requirement()]
        self.assertTrue(req.testable)

        req = Requirement()
        req.details = [Requirement(skip=True)]
        self.assertFalse(req.testable)

        req = Requirement()
        req.details = [Requirement(deleted=True)]
        self.assertFalse(req.testable)
コード例 #11
0
    def testClassification(self):
        req = Requirement()
        self.assertIsNone(req.classification)

        req = Requirement(classification='andrew')
        self.assertEqual(req.classification, 'andrew')