'Test single- and multi-asset queries on restrictions defined by
zipline.utils.security_list.SecurityList'

def test_security_list_restrictions(self):

    class SecurityList(object, ):
        def __init__(self, assets_by_dt):
            self.assets_by_dt = assets_by_dt
        def current_securities(self, dt):
            return self.assets_by_dt[dt]
    assets_by_dt = {str_to_ts('2011-01-03'): [self.ASSET1], str_to_ts('2011-01-04'): [self.ASSET2, self.ASSET3], str_to_ts('2011-01-05'): [self.ASSET1, self.ASSET2, self.ASSET3]}
    rl = SecurityListRestrictions(SecurityList(assets_by_dt))
    assert_not_restricted = partial(self.assert_not_restricted, rl)
    assert_is_restricted = partial(self.assert_is_restricted, rl)
    assert_all_restrictions = partial(self.assert_all_restrictions, rl)
    assert_is_restricted(self.ASSET1, str_to_ts('2011-01-03'))
    assert_not_restricted(self.ASSET2, str_to_ts('2011-01-03'))
    assert_not_restricted(self.ASSET3, str_to_ts('2011-01-03'))
    assert_all_restrictions([True, False, False], str_to_ts('2011-01-03'))
    assert_not_restricted(self.ASSET1, str_to_ts('2011-01-04'))
    assert_is_restricted(self.ASSET2, str_to_ts('2011-01-04'))
    assert_is_restricted(self.ASSET3, str_to_ts('2011-01-04'))
    assert_all_restrictions([False, True, True], str_to_ts('2011-01-04'))
    assert_is_restricted(self.ASSET1, str_to_ts('2011-01-05'))
    assert_is_restricted(self.ASSET2, str_to_ts('2011-01-05'))
    assert_is_restricted(self.ASSET3, str_to_ts('2011-01-05'))
    assert_all_restrictions([True, True, True], str_to_ts('2011-01-05'))
