Exemplo n.º 1
0
 def test_ne_style(self):
     style2 = Style(
         u"English Pale Ale",
         category=u"18",
         subcategory=u"B",
         og=[1.045, 1.06],
         fg=[1.010, 1.015],
         abv=[0.045, 0.062],
         ibu=[30, 50],
         color=[5, 10],
     )
     self.assertTrue(self.style != style2)
Exemplo n.º 2
0
 def test_ne_abv(self):
     style2 = Style(
         u"American Pale Ale",
         category=u"18",
         subcategory=u"B",
         og=[1.045, 1.06],
         fg=[1.010, 1.015],
         abv=[4.5, 6.3],
         ibu=[30, 50],
         color=[5, 10],
     )
     self.assertTrue(self.style != style2)
Exemplo n.º 3
0
 def test_unicode(self):
     style = Style(
         u"Kölsh",
         category=u"5",
         subcategory=u"B",
         og=[1.044, 1.050],
         fg=[1.007, 1.011],
         abv=[0.044, 0.052],
         ibu=[18, 30],
         color=[3.5, 5],
     )
     out = str(style)
     if sys.version_info[0] >= 3:
         self.assertEquals(out, u"5B Kölsh")
     else:
         self.assertEquals(out, u"5B Kölsh".encode("utf8"))
Exemplo n.º 4
0
 def test_validate_input_list_bad_order(self):
     with self.assertRaises(StyleException) as ctx:
         Style._validate_input_list([2, 1], (int, float), u"OG")
     self.assertEquals(str(ctx.exception),
                       u"OG values must be lowest value first")  # noqa
Exemplo n.º 5
0
 def test_validate_input_list_bad_order(self):
     with self.assertRaises(Exception):
         Style._validate_input_list([2, 1], (int, float), u'OG')
Exemplo n.º 6
0
 def test_validate_input_list_length_long(self):
     with self.assertRaises(StyleException) as ctx:
         Style._validate_input_list([1, 2, 3], (int, float), u"OG")
     self.assertEquals(str(ctx.exception), u"OG must contain two values")
Exemplo n.º 7
0
 def test_validate_input_list_wrong_type(self):
     with self.assertRaises(StyleException) as ctx:  # noqa
         Style._validate_input_list([1, u"2"], (int, float), u"OG")
Exemplo n.º 8
0
 def test_validate_input_list_type(self):
     with self.assertRaises(StyleException) as ctx:
         Style._validate_input_list({u"a": u"b"}, (int, float), u"OG")
     self.assertEquals(str(ctx.exception), u"OG must be a list")
Exemplo n.º 9
0
 def test_validate(self):
     data = self.style.to_dict()
     Style.validate(data)
Exemplo n.º 10
0
 def test_validate_input_list_type(self):
     with self.assertRaises(StyleException) as ctx:
         Style._validate_input_list({u'a': u'b'}, (int, float), u'OG')
     self.assertEquals(str(ctx.exception),
                       u"OG must be a list")
Exemplo n.º 11
0
 def test_validate_input_list_empty(self):
     with self.assertRaises(StyleException) as ctx:
         Style._validate_input_list(None, (int, float), u"OG")
     self.assertEquals(str(ctx.exception),
                       u"Must provide value_list for OG")
Exemplo n.º 12
0
 def test_validate_input_list_wrong_type(self):
     with self.assertRaises(Exception):
         Style._validate_input_list([1, u'2'], (int, float), u'OG')
Exemplo n.º 13
0
 def test_validate_input_list_length_long(self):
     with self.assertRaises(StyleException) as ctx:
         Style._validate_input_list([1, 2, 3], (int, float), u'OG')
     self.assertEquals(str(ctx.exception),
                       u"OG must contain two values")
Exemplo n.º 14
0
 def test_validate_input_list_length_long(self):
     with self.assertRaises(Exception):
         Style._validate_input_list([1, 2, 3], (int, float), u'OG')
Exemplo n.º 15
0
 def test_validate(self):
     data = self.style.to_dict()
     Style.validate(data)
Exemplo n.º 16
0
 def test_validate_input_list_type(self):
     with self.assertRaises(Exception):
         Style._validate_input_list({u'a': u'b'}, (int, float), u'OG')
Exemplo n.º 17
0
 def test_validate_input_list_empty(self):
     with self.assertRaises(Exception):
         Style._validate_input_list(None, (int, float), u'OG')
Exemplo n.º 18
0
 def test_validate_input_list_bad_order(self):
     with self.assertRaises(StyleException) as ctx:
         Style._validate_input_list([2, 1], (int, float), u'OG')
     self.assertEquals(str(ctx.exception),
                       u"OG values must be lowest value first")  # noqa
Exemplo n.º 19
0
    name=u"pale ale",
    grain_list=grain_list,
    hop_list=hop_list,
    target_ibu=33.0,
    target_og=1.0761348,
    brew_house_yield=0.70,
    start_volume=7.0,
    final_volume=5.0,
)

# Define a Style
american_pale_ale_style = Style(
    u"American Pale Ale",
    category=u"18",
    subcategory=u"B",
    og=[1.045, 1.06],
    fg=[1.010, 1.015],
    abv=[0.045, 0.062],
    ibu=[30, 50],
    color=[5, 10],
)

english_pale_ale_style = Style(
    u"Ordinary Bitter",
    category=u"11",
    subcategory=u"A",
    og=[1.030, 1.039],
    fg=[1.007, 1.011],
    abv=[0.032, 0.038],
    ibu=[25, 35],
    color=[8, 14],
)
Exemplo n.º 20
0
 def test_validate_input_list_empty(self):
     with self.assertRaises(StyleException) as ctx:
         Style._validate_input_list(None, (int, float), u'OG')
     self.assertEquals(str(ctx.exception),
                       u"Must provide value_list for OG")