devtools/test/unittest_fill.py
changeset 9675 8aabfefc8a81
parent 9674 96549de9dd70
equal deleted inserted replaced
9674:96549de9dd70 9675:8aabfefc8a81
    37         for attrname in attrvalues - set(self.attrvalues):
    37         for attrname in attrvalues - set(self.attrvalues):
    38             delattr(_ValueGenerator, attrname)
    38             delattr(_ValueGenerator, attrname)
    39 
    39 
    40 
    40 
    41     def test_autoextend(self):
    41     def test_autoextend(self):
    42         self.assertFalse('generate_server' in dir(ValueGenerator))
    42         self.assertNotIn('generate_server', dir(ValueGenerator))
    43         class MyValueGenerator(ValueGenerator):
    43         class MyValueGenerator(ValueGenerator):
    44             def generate_server(self, index):
    44             def generate_server(self, index):
    45                 return attrname
    45                 return attrname
    46         self.assertIn('generate_server', dir(ValueGenerator))
    46         self.assertIn('generate_server', dir(ValueGenerator))
    47 
    47 
    48 
    48 
    49     def test_bad_signature_detection(self):
    49     def test_bad_signature_detection(self):
    50         self.assertFalse('generate_server' in dir(ValueGenerator))
    50         self.assertNotIn('generate_server', dir(ValueGenerator))
    51         try:
    51         try:
    52             class MyValueGenerator(ValueGenerator):
    52             class MyValueGenerator(ValueGenerator):
    53                 def generate_server(self):
    53                 def generate_server(self):
    54                     pass
    54                     pass
    55         except TypeError:
    55         except TypeError:
    56             self.assertFalse('generate_server' in dir(ValueGenerator))
    56             self.assertNotIn('generate_server', dir(ValueGenerator))
    57         else:
    57         else:
    58             self.fail('TypeError not raised')
    58             self.fail('TypeError not raised')
    59 
    59 
    60 
    60 
    61     def test_signature_extension(self):
    61     def test_signature_extension(self):
    62         self.assertFalse('generate_server' in dir(ValueGenerator))
    62         self.assertNotIn('generate_server', dir(ValueGenerator))
    63         class MyValueGenerator(ValueGenerator):
    63         class MyValueGenerator(ValueGenerator):
    64             def generate_server(self, index, foo):
    64             def generate_server(self, index, foo):
    65                 pass
    65                 pass
    66         self.assertIn('generate_server', dir(ValueGenerator))
    66         self.assertIn('generate_server', dir(ValueGenerator))
    67 
    67