Example #1
0
    def simplify_such_that(self, t, f):
        tracker = Tracker()

        while True:
            for s in self.simplify(t):
                if tracker.track(s) > 1: 
                    continue
                if f(s):
                    t = s
                    break
            else:
                return t  
Example #2
0
    def simplify_such_that(self, t, f):
        tracker = Tracker()

        while True:
            for s in self.simplify(t):
                if tracker.track(s) > 1:
                    continue
                if f(s):
                    t = s
                    break
            else:
                return t
Example #3
0
def test_track_lists():
    t = Tracker()
    assert t.track([1]) == 1
    assert t.track([1]) == 2
Example #4
0
def test_track_ints():
    t = Tracker()
    assert t.track(1) == 1
    assert t.track(1) == 2
Example #5
0
def test_nested_unhashables():
    t = Tracker()
    x = {"foo": [1, 2, {3, 4, 5, 6}], "bar": 10}
    assert t.track(x) == 1
    assert t.track(x) == 2
Example #6
0
def assert_no_duplicates_in_simplify(s, x):
    s = strategy(s)
    t = Tracker()
    t.track(x)
    for y in s.simplify(x):
        assert t.track(y) == 1
Example #7
0
def assert_no_duplicates_in_simplify(s, x):
    s = strategy(s)
    t = Tracker()
    t.track(x)
    for y in s.simplify(x):
        assert t.track(y) == 1
def test_track_lists():
    t = Tracker()
    assert t.track([1]) == 1
    assert t.track([1]) == 2
def test_track_ints():
    t = Tracker()
    assert t.track(1) == 1
    assert t.track(1) == 2
Example #10
0
def test_nested_unhashables():
    t = Tracker()
    x = {"foo" : [1,2,{3,4,5,6}], "bar" : 10}
    assert t.track(x) == 1
    assert t.track(x) == 2