
Removes H102 (license header not found) check from flake8 ignore list. Adds missing apache license headers. Change-Id: I109f23c6d8b2e3efb1dac7f764bd77e0d9d335f0
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from nose.tools import ok_
|
|
|
|
|
|
def fail(msg):
|
|
raise AssertionError(msg)
|
|
|
|
|
|
def assert_in(thing, seq, msg=None):
|
|
msg = msg or "'%s' not found in %s" % (thing, seq)
|
|
ok_(thing in seq, msg)
|
|
|
|
|
|
def assert_not_in(thing, seq, msg=None):
|
|
msg = msg or "unexpected '%s' found in %s" % (thing, seq)
|
|
ok_(thing not in seq, msg)
|
|
|
|
|
|
def assert_has_keys(dict, required=[], optional=[]):
|
|
keys = dict.keys()
|
|
for k in required:
|
|
assert_in(k, keys, "required key %s missing from %s" % (k, dict))
|
|
allowed_keys = set(required) | set(optional)
|
|
extra_keys = set(keys).difference(allowed_keys)
|
|
if extra_keys:
|
|
fail("found unexpected keys: %s" % list(extra_keys))
|
|
|
|
|
|
def assert_isinstance(thing, kls):
|
|
ok_(isinstance(thing, kls), "%s is not an instance of %s" % (thing, kls))
|