예제 #1
0
 def test_initialization_with_invalid_options_throw_error(self):
     with pytest.raises(ValueError):
         NumberWithUnitRecognizer(self.invalid_culture, -1)
예제 #2
0
 def test_without_target_culture_and_without_culture_fallback_to_english_culture(
         self):
     recognizer = NumberWithUnitRecognizer()
     self.assert_models_equal(self.control_model,
                              recognizer.get_dimension_model())
예제 #3
0
 def test_initialization_with_int_option_resolve_options_enum(self):
     recognizer = NumberWithUnitRecognizer(self.english_culture,
                                           NumberWithUnitOptions.NONE,
                                           False)
     assert (recognizer.options
             & NumberWithUnitOptions.NONE) == NumberWithUnitOptions.NONE
예제 #4
0
 def test_with_invalid_culture_as_target_and_without_fallback_throw_error(
         self):
     recognizer = NumberWithUnitRecognizer(self.invalid_culture)
     with pytest.raises(ValueError):
         recognizer.get_dimension_model(None, False)
예제 #5
0
 def test_with_invalid_culture_use_target_culture(self):
     recognizer = NumberWithUnitRecognizer(self.spanish_culture)
     self.assert_models_equal(
         self.control_model,
         recognizer.get_dimension_model(self.invalid_culture))
예제 #6
0
 def test_withOtherCulture_not_use_target_culture(self):
     recognizer = NumberWithUnitRecognizer(self.english_culture)
     self.assert_models_distinct(
         self.control_model,
         recognizer.get_dimension_model(self.spanish_culture))
예제 #7
0
 def test_without_culture_use_target_culture(self):
     recognizer = NumberWithUnitRecognizer(self.english_culture)
     self.assert_models_equal(self.control_model,
                              recognizer.get_dimension_model())
예제 #8
0
 def test_with_invalid_culture_and_without_fallback_throw_error(self):
     recognizer = NumberWithUnitRecognizer()
     with pytest.raises(ValueError):
         recognizer.get_currency_model(self.invalid_culture, False)