def test_hex_probs_hex_out(self): """Test hexadecimal input and hexadecimal output.""" in_probs = { "0x0": 2 / 7, "0x1": 1 / 7, "0x2": 1 / 7, "0x3": 1 / 7, "0x4": 2 / 7 } probs = ProbDistribution(in_probs) self.assertEqual(in_probs, probs.hex_probabilities())
def test_bin_probs_hex_out(self): """Test binary input and hexadecimal output.""" in_probs = { "0b0": 2 / 7, "0b1": 1 / 7, "0b10": 1 / 7, "0b11": 1 / 7, "0b100": 2 / 7 } probs = ProbDistribution(in_probs) expected = { "0x0": 2 / 7, "0x1": 1 / 7, "0x2": 1 / 7, "0x3": 1 / 7, "0x4": 2 / 7 } self.assertEqual(expected, probs.hex_probabilities())
def test_empty_hex_out(self): """Test empty input with hexadecimal output.""" probs = ProbDistribution({}) self.assertEqual(probs.hex_probabilities(), {})