On Mon, Sep 23, 2013 at 2:25 PM, Jose A. Lopes <[email protected]> wrote:

> > diff --git a/test/py/ganeti.rpc_unittest.py b/test/py/
> ganeti.rpc_unittest.py
> > index 38faa02..86b8b66 100755
> > --- a/test/py/ganeti.rpc_unittest.py
> > +++ b/test/py/ganeti.rpc_unittest.py
> > @@ -481,11 +481,11 @@ class TestNodeConfigResolver(unittest.TestCase):
> >  class TestCompress(unittest.TestCase):
> >    def test(self):
> >      for data in ["", "Hello", "Hello World!\nnew\nlines"]:
> > -      self.assertEqual(rpc._Compress(data),
> > +      self.assertEqual(rpc._Compress(NotImplemented, data),
> >                         (constants.RPC_ENCODING_NONE, data))
>
> Is using 'NotImplemented' the best way to achieve the fact that
> 'Compress' does not care about its first argument ? Can't we do the
> same thing we are doing below and use the 'nodes' variable ?
>
> >
> >      for data in [512 * " ", 5242 * "Hello World!\n"]:
> > -      compressed = rpc._Compress(data)
> > +      compressed = rpc._Compress(NotImplemented, data)
>
> Same.
>

In those cases, there are no mocked nodes to pass as first argument.
Passing NotImplemented in lieu of arguments which are not used is commonly
used in Ganeti tests, as each access to NotImplemented would result in an
error. So it's effectively a test for the argument not being used as well.


>
> Thanks,
> Jose
>
> --
> Jose Antonio Lopes
> Ganeti Engineering
> Google Germany GmbH
> Dienerstr. 12, 80331, München
>
> Registergericht und -nummer: Hamburg, HRB 86891
> Sitz der Gesellschaft: Hamburg
> Geschäftsführer: Graham Law, Christine Elizabeth Flores
> Steuernummer: 48/725/00206
> Umsatzsteueridentifikationsnummer: DE813741370
>



-- 
Thomas Thrainer | Software Engineer | [email protected] |

Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to