Skip to content

Commit c61f44d

Browse files
committed
Improved Attribute testcases on FileSets.
1 parent 36fff0e commit c61f44d

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

tests/unit/FileSet.py

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,10 @@ def test_FileSet(self):
318318
fileSet.Validate()
319319

320320

321+
class Attr(Attribute):
322+
pass
323+
324+
321325
class Attributes(TestCase):
322326
def test_AddAttribute_WrongType(self):
323327
fileSet = FileSet("fileset")
@@ -328,7 +332,30 @@ def test_AddAttribute_WrongType(self):
328332
def test_AddAttribute_Normal(self):
329333
fileSet = FileSet("fileset")
330334

331-
class Attr(Attribute):
332-
pass
335+
fileSet[Attr] = 5
336+
337+
def test_GetAttribute_WrongType(self):
338+
fileSet = FileSet("fileset")
339+
fileSet[Attr] = 5
340+
341+
with self.assertRaises(TypeError):
342+
_ = fileSet["attr"]
333343

344+
def test_GetAttribute_Normal(self):
345+
fileSet = FileSet("fileset")
334346
fileSet[Attr] = 5
347+
348+
_ = fileSet[Attr]
349+
350+
def test_DelAttribute_WrongType(self):
351+
fileSet = FileSet("fileset")
352+
fileSet[Attr] = 5
353+
354+
with self.assertRaises(TypeError):
355+
del fileSet["attr"]
356+
357+
def test_DelAttribute_Normal(self):
358+
fileSet = FileSet("fileset")
359+
fileSet[Attr] = 5
360+
361+
del fileSet[Attr]

0 commit comments

Comments
 (0)