Example #1
0
 def to_basic(self, value):
     try:
         return real_index(self.choices, value)
     except ValueError:
         raise WrongFormat('%r is not in %r' % (
             value,
             self.choices,
         ))
Example #2
0
def test_actually_index_can_use_real_index():
    t = [set()]
    assert real_index(t, set()) == 0
Example #3
0
def test_actually_index_can_index_past_an_inequal_thing():
    t = [frozenset(), set()]
    assert real_index(t, set()) == 1
Example #4
0
def test_actually_index_does_not_index_not_actually_equal_things():
    t = [frozenset()]
    with pytest.raises(ValueError):
        real_index(t, set())