本文整理汇总了Python中nose.tools.assert_not_equals函数的典型用法代码示例。如果您正苦于以下问题:Python assert_not_equals函数的具体用法?Python assert_not_equals怎么用?Python assert_not_equals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_not_equals函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_upgrade_from_pbkdf2_with_less_rounds
def test_upgrade_from_pbkdf2_with_less_rounds(self):
'''set up a pbkdf key with less than the default rounds
If the number of default_rounds is increased in a later version of
passlib, ckan should upgrade the password hashes for people without
involvement from users'''
user = factories.User()
password = u'testpassword'
user_obj = model.User.by_name(user['name'])
# setup hash with salt/rounds less than the default
old_hash = pbkdf2_sha512.encrypt(password, salt_size=2, rounds=10)
user_obj._password = old_hash
user_obj.save()
nt.assert_true(user_obj.validate_password(password.encode('utf-8')))
# check that the hash has been updated
nt.assert_not_equals(old_hash, user_obj.password)
new_hash = pbkdf2_sha512.from_string(user_obj.password)
nt.assert_true(pbkdf2_sha512.default_rounds > 10)
nt.assert_equals(pbkdf2_sha512.default_rounds, new_hash.rounds)
nt.assert_true(pbkdf2_sha512.default_salt_size, 2)
nt.assert_equals(pbkdf2_sha512.default_salt_size,
len(new_hash.salt))
nt.assert_true(pbkdf2_sha512.verify(password, user_obj.password))
示例2: test_without_ax
def test_without_ax(self):
fig, ax = validate.mpl_ax(None)
nt.assert_not_equals(self.fig, fig)
nt.assert_not_equals(self.ax, ax)
nt.assert_true(isinstance(fig, plt.Figure))
nt.assert_true(isinstance(ax, plt.Axes))
示例3: test_caching_is_per_instance
def test_caching_is_per_instance():
# Test that values cached for one instance do not appear on another
class FieldTester(object):
"""Toy class for ModelMetaclass and field access testing"""
__metaclass__ = ModelMetaclass
field_a = List(scope=Scope.settings)
def __init__(self, model_data):
self._model_data = model_data
self._dirty_fields = set()
model_data = MagicMock(spec=dict)
model_data.__getitem__ = lambda self, name: [name]
# Same model_data used in different objects should result
# in separately-cached values, so that changing a value
# in one instance doesn't affect values stored in others.
field_tester_a = FieldTester(model_data)
field_tester_b = FieldTester(model_data)
value = field_tester_a.field_a
assert_equals(value, field_tester_a.field_a)
field_tester_a.field_a.append(1)
assert_equals(value, field_tester_a.field_a)
assert_not_equals(value, field_tester_b.field_a)
示例4: test_security_comparisons
def test_security_comparisons(self):
assert_equals(Security("USD"), USD)
assert_equals(Security("USD"), Security("USD"))
assert_equals(Security("BTC"), Security("BTC"))
assert_not_equals(Security("INR"), USD)
assert_not_equals(Security("INR"), Security("BTC"))
示例5: test_inequality
def test_inequality(self):
layer_a = TransportAddress()
layer_b = TransportAddress(high=2)
assert_not_equals(layer_a, layer_b)
layer_a.low = 2
layer_b.high = 65535
assert_not_equals(layer_a, layer_b)
示例6: test_gen_minhash
def test_gen_minhash(self):
actual = self.bbmh.gen_minhash(['love', 'me'])
assert_equals(len(actual), self.bbmh.num_hashes)
assert_true(isinstance(actual, np.ndarray))
other_hash = self.bbmh.gen_minhash(['tokyo', 'sushi'])
assert_not_equals(actual.tostring(), other_hash.tostring())
示例7: test_active_dois
def test_active_dois(self, test_data):
(doi, fulltext_url, license, color) = test_data
# because cookies breaks the cache pickling
# for doi_start in ["10.1109", "10.1161", "10.1093", "10.1007", "10.1039"]:
# if doi.startswith(doi_start):
# requests_cache.uninstall_cache()
my_pub = pub.lookup_product_by_doi(doi)
my_pub.refresh()
logger.info(u"\n\nwas looking for {}, got {}".format(fulltext_url, my_pub.fulltext_url))
logger.info(u"https://api.unpaywall.org/v2/{}?email=me".format(doi))
logger.info(u"doi: https://doi.org/{}".format(doi))
logger.info(u"license: {}".format(my_pub.license))
logger.info(u"oa_color: {}".format(my_pub.oa_color))
logger.info(u"evidence: {}".format(my_pub.evidence))
if my_pub.error:
logger.info(my_pub.error)
assert_equals(my_pub.error, "")
assert_equals(my_pub.fulltext_url, fulltext_url)
assert_not_equals(my_pub.fulltext_url, None)
# assert_equals(my_pub.license, license)
assert_equals(my_pub.error, "")
示例8: test_create_periodic_report_with_group
def test_create_periodic_report_with_group():
collection = get_mongo_collection()
collection.remove()
collection.insert({
'event': "statistc",
'timestamp': datetime(2011, 4, 7),
'params': {"url": "www.centrum.cz"}
})
collection.insert({
'event': "statistc",
'timestamp': datetime(2011, 4, 1),
'params': {"url": "www.centrum.cz"}
})
collection.insert({
'event': "statistc",
'timestamp': datetime(2011, 3, 7),
'params': {"url": "www.centrum.cz"}
})
collection.insert({
'event': "statistc",
'timestamp': datetime(2011, 3, 21),
'params': {"url": "www.centrum.cz"}
})
report = Report(title="report group", description="test", db_query='db.%s.group({ key : { "params.url" : true }, condition : { event : "statistic", timestamp : {$gt : ${{d1}}, $lt: ${{d2}}} }, reduce : function( obj, prev ) { prev.total++; }, initial : { total : 0 } })' % (STATISTICS_MONGODB_COLLECTION,), interval='m')
report.save()
tools.assert_equals(True, create_reports())
tools.assert_not_equals(ReportResult.objects.all().count(), 0)
tools.assert_not_equals(Report.objects.all()[0].last_report, None)
collection.remove()
示例9: test_inequality
def test_inequality(self):
group01 = NetworkGroup()
group02 = NetworkGroup()
group01.add(self.address01)
assert_not_equals(group01, group02)
group02.add(self.address01)
assert_not_equals(group01, group02)
示例10: test_equality
def test_equality(self):
ctx01 = DeviceContext('ctx01')
ctx02 = DeviceContext('ctx02')
ctx03 = DeviceContext('ctx03')
assert_equals(self.ctx01, ctx01)
assert_not_equals(self.ctx01, ctx03)
assert_not_equals(ctx02, ctx03)
示例11: test_create_aperiodic_report_with_mapreduce
def test_create_aperiodic_report_with_mapreduce():
collection = get_mongo_collection()
collection.remove()
collection.insert({
'event': "statistic",
'timestamp': datetime(2010, 4, 1),
'params': {"url": "www.atlas.cz"}
})
collection.insert({
'event': "statistic",
'timestamp': datetime(2011, 3, 7),
'params': {"url": "www.centrum.cz"}
})
collection.insert({
'event': "statistic",
'timestamp': datetime(2011, 3, 21),
'params': {"url": "www.centrum.cz"}
})
report = Report(title="report mapreduce", description="test", db_query='m = function() { if (this.event == "statistic") { emit(this.params.url, 1); }};r = function(url, nums) { var total=0; for (var i=0; i<nums.length; i++) { total += nums[i]; } return total; };res = db.%s.mapReduce(m, r);res.find().forEach(printjson);' % (STATISTICS_MONGODB_COLLECTION,), interval='n')
report.save()
tools.assert_equals(True, create_reports())
tools.assert_not_equals(ReportResult.objects.all().count(), 0)
tools.assert_not_equals(Report.objects.all()[0].last_report, None)
tools.assert_equals(ReportResult.objects.all()[0].output, '{ "_id" : "www.atlas.cz", "value" : 1 }\n{ "_id" : "www.centrum.cz", "value" : 2 }\n')
collection.remove()
示例12: test_ineqaulity
def test_ineqaulity(self):
acl01 = Acl()
acl01.add(Ace(logging=2))
acl02 = Acl()
assert_not_equals(acl01, acl02)
acl02.add(Ace())
assert_not_equals(acl01, acl02)
示例13: test_inheritable_attribute
def test_inheritable_attribute(self):
# days_early_for_beta isn't a basic attribute of Sequence
assert_false(hasattr(SequenceDescriptor, 'days_early_for_beta'))
# days_early_for_beta is added by InheritanceMixin
assert_true(hasattr(InheritanceMixin, 'days_early_for_beta'))
root = SequenceFactory.build(policy={'days_early_for_beta': '2'})
ProblemFactory.build(parent=root)
# InheritanceMixin will be used when processing the XML
assert_in(InheritanceMixin, root.xblock_mixins)
seq = self.process_xml(root)
assert_equals(seq.unmixed_class, SequenceDescriptor)
assert_not_equals(type(seq), SequenceDescriptor)
# days_early_for_beta is added to the constructed sequence, because
# it's in the InheritanceMixin
assert_equals(2, seq.days_early_for_beta)
# days_early_for_beta is a known attribute, so we shouldn't include it
# in xml_attributes
assert_not_in('days_early_for_beta', seq.xml_attributes)
示例14: test_caching_is_per_instance
def test_caching_is_per_instance():
# Test that values cached for one instance do not appear on another
class FieldTester(object):
"""Toy class for ModelMetaclass and field access testing"""
__metaclass__ = ModelMetaclass
field_a = List(scope=Scope.settings)
def __init__(self, field_data):
self._field_data = field_data
self._dirty_fields = {}
field_data = MagicMock(spec=FieldData)
field_data.get = lambda block, name, default=None: [name] # pylint: disable=C0322
# Same field_data used in different objects should result
# in separately-cached values, so that changing a value
# in one instance doesn't affect values stored in others.
field_tester_a = FieldTester(field_data)
field_tester_b = FieldTester(field_data)
value = field_tester_a.field_a
assert_equals(value, field_tester_a.field_a)
field_tester_a.field_a.append(1)
assert_equals(value, field_tester_a.field_a)
assert_not_equals(value, field_tester_b.field_a)
示例15: test_result_does_not_reflect_changes
def test_result_does_not_reflect_changes(self):
model = Question
for i in range(1, 5):
create_question(self, question_text="question %s" % i)
all_questions = list(model.objects.all().order_by('pk'))
with self.assertNumQueries(1):
cached_questions = get_cached_all_guestions()
tools.assert_equals(cached_questions, all_questions)
with self.assertNumQueries(0):
cached_questions = get_cached_all_guestions()
tools.assert_equals(cached_questions, all_questions)
create_question(self, question_text="question 7")
all_questions_old = all_questions
all_questions = list(model.objects.all().order_by('pk'))
with self.assertNumQueries(0):
cached_questions = get_cached_all_guestions()
tools.assert_equals(cached_questions, all_questions_old)
tools.assert_not_equals(cached_questions, all_questions)
tools.assert_true(len(cached_questions), 6)
tools.assert_true(len(all_questions), 7)