def test_sets_correct_data(self): percentage = Percentage(value=0.5) data = { "type": PercentageBucketer.get_type(), "percentage": percentage.to_dict(), } bucketer = PercentageBucketer.from_dict(data) self.assertEqual(data, bucketer.to_dict())
def test_returns_correct_data(self): percentage = Percentage(value=0.5) bucketer = PercentageBucketer(percentage=percentage) expected = { "type": PercentageBucketer.get_type(), "percentage": percentage.to_dict(), } self.assertEqual(expected, bucketer.to_dict())
def test_passes_arguments_through_to_created_bucketer(self): percentage = 0.21 bucketer = BucketerFactory.create( { "type": PercentageBucketer.get_type(), "percentage": Percentage(value=percentage).to_dict(), } ) self.assertEqual(percentage, bucketer.percentage)
def test_is_correct_value(self): bucketer = PercentageBucketer() self.assertEqual("PercentageBucketer", bucketer.get_type())
def test_creates_percentage_bucketer(self): bucketer = BucketerFactory.create({"type": PercentageBucketer.get_type()}) self.assertIsInstance(bucketer, PercentageBucketer)