# Path: brew/cli/gravity_volume.py
# def get_parser():
#     parser = argparse.ArgumentParser(description=u"Gravity-Volume Conversion")
#     parser.add_argument(
#         u"-o",
#         u"--original-volume",
#         metavar=u"V",
#         type=float,
#         required=True,
#         help=u"Original Volume",
#     )
#     parser.add_argument(
#         u"-f",
#         u"--final-volume",
#         metavar=u"V",
#         type=float,
#         required=True,
#         help=u"Final Volume",
#     )
#     parser.add_argument(
#         u"-g", u"--gravity", metavar=u"G", type=float, required=True, help=u"Gravity"
#     )
#     return parser
# 
# Path: brew/cli/gravity_volume.py
# def get_gravity(original_volume, final_volume, gravity):
#     """
#     Convert gravity at original volume to gravity at final volume
#     """
#     return gu_to_sg(sg_to_gu(gravity) * original_volume / final_volume)
# 
# Path: brew/cli/gravity_volume.py
# def main(parser_fn=get_parser, parser_kwargs=None):
#     parser = None
#     if not parser_kwargs:
#         parser = parser_fn()
#     else:
#         parser = parser_fn(**parser_kwargs)
#     args = parser.parse_args()
#     if not all([args.original_volume, args.final_volume, args.gravity]):
#         print("Please provide all arguments")
#         sys.exit(1)
#     out = get_gravity(args.original_volume, args.final_volume, args.gravity)
#     print("{:0.3f}".format(out))


import unittest
from brew.cli.gravity_volume import get_parser
from brew.cli.gravity_volume import get_gravity
from brew.cli.gravity_volume import main
    def setUp(self):
        self.parser = get_parser()

    def test_get_parser(self):
        args = [u"-o", u"3.0", u"-f", u"10.0", u"-g", u"1.050"]
        out = self.parser.parse_args(args)
        expected = {u"original_volume": 3.0, u"final_volume": 10.0, u"gravity": 1.050}
        self.assertEquals(out.__dict__, expected)


class TestCliMainTemp(unittest.TestCase):
    def setUp(self):
        class Parser(object):
            def __init__(self, output):
                self.output = output

            def parse_args(self):
                class Args(object):
                    pass

                args = Args()
                if self.output:
                    for k, v in self.output.items():
                        setattr(args, k, v)
                return args

        def g_parser(output=None):
            return Parser(output)

        self.parser_fn = g_parser

# Path: brew/cli/gravity_volume.py
# def get_parser():
#     parser = argparse.ArgumentParser(description=u"Gravity-Volume Conversion")
#     parser.add_argument(
#         u"-o",
#         u"--original-volume",
#         metavar=u"V",
#         type=float,
#         required=True,
#         help=u"Original Volume",
#     )
#     parser.add_argument(
#         u"-f",
#         u"--final-volume",
#         metavar=u"V",
#         type=float,
#         required=True,
#         help=u"Final Volume",
#     )
#     parser.add_argument(
#         u"-g", u"--gravity", metavar=u"G", type=float, required=True, help=u"Gravity"
#     )
#     return parser
# 
# Path: brew/cli/gravity_volume.py
# def get_gravity(original_volume, final_volume, gravity):
#     """
#     Convert gravity at original volume to gravity at final volume
#     """
#     return gu_to_sg(sg_to_gu(gravity) * original_volume / final_volume)
# 
# Path: brew/cli/gravity_volume.py
# def main(parser_fn=get_parser, parser_kwargs=None):
#     parser = None
#     if not parser_kwargs:
#         parser = parser_fn()
#     else:
#         parser = parser_fn(**parser_kwargs)
#     args = parser.parse_args()
#     if not all([args.original_volume, args.final_volume, args.gravity]):
#         print("Please provide all arguments")
#         sys.exit(1)
#     out = get_gravity(args.original_volume, args.final_volume, args.gravity)
#     print("{:0.3f}".format(out))


# Path: tests/test_cli_gravity_volume.py
import unittest
from brew.cli.gravity_volume import get_parser
from brew.cli.gravity_volume import get_gravity
from brew.cli.gravity_volume import main

    def setUp(self):
        self.parser = get_parser()

    def test_get_parser(self):
        args = [u"-o", u"3.0", u"-f", u"10.0", u"-g", u"1.050"]
        out = self.parser.parse_args(args)
        expected = {u"original_volume": 3.0, u"final_volume": 10.0, u"gravity": 1.050}
        self.assertEquals(out.__dict__, expected)


class TestCliMainTemp(unittest.TestCase):
    def setUp(self):
        class Parser(object):
            def __init__(self, output):
                self.output = output

            def parse_args(self):
                class Args(object):
                    pass

                args = Args()
                if self.output:
                    for k, v in self.output.items():
                        setattr(args, k, v)
                return args

        def g_parser(output=None):
            return Parser(output)

        self.parser_fn = g_parser

        self.main = main