Show
Ignore:
Timestamp:
08/21/08 16:42:38 (5 years ago)
Author:
Nicolas ?vrard <nicoe@…>
Branch:
default
Message:

Use the same signature for generate and for report.call

Using coverage.py to complete the tests

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • relatorio/tests/test_api.py

    r51 r60  
    3636    MIMETemplateLoader.load_template_engines() 
    3737 
    38  
    3938class TestRepository(object): 
    4039 
     
    5958        eq_(report, report2) 
    6059 
     60    def abspath_helper(self, path): 
     61        return _absolute(path) 
     62 
    6163    def test_absolute(self): 
    6264        "Test the absolute path calculation" 
     65        eq_("/home/nicoe/python/mock.py", 
     66            _absolute("/home/nicoe/python/mock.py")) 
     67 
    6368        our_dir, _ = os.path.split(__file__) 
    64         new_path = _absolute(os.path.join('brol', 'toto')) 
     69        # We use this because me go up by two frames 
     70        new_path = self.abspath_helper(os.path.join('brol', 'toto')) 
    6571        eq_(os.path.join(our_dir, 'brol', 'toto'), new_path) 
    6672 
     
    7783        "Testing the report generation" 
    7884        a = StubObject(name='OpenHex') 
    79         eq_(self.report(a).render(), 'Hello OpenHex.\n') 
     85        eq_(self.report(o=a).render(), 'Hello OpenHex.\n') 
    8086 
    8187    def test_factory(self): 
    8288        "Testing the data factory" 
    8389        class MyFactory: 
    84             def __call__(self, obj, time, y=1): 
     90            def __call__(self, o, time, y=1): 
    8591                d = dict() 
    86                 d['o'] = obj 
     92                d['o'] = o 
    8793                d['y'] = y 
    8894                d['time'] = time 
     
    95101 
    96102        a = StubObject(name='Foo') 
    97         eq_(report(a, time="One o'clock").render(),  
     103        eq_(report(o=a, time="One o'clock").render(),  
    98104            "Hi Foo,\nIt's One o'clock to 2 !\n") 
    99         eq_(report(a, time="One o'clock", y=4).render(),  
     105        eq_(report(o=a, time="One o'clock", y=4).render(),  
    100106            "Hi Foo,\nIt's One o'clock to 5 !\n") 
    101107        assert_raises(TypeError, report, a)