New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

assertlib

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assertlib - pypi Package Compare versions

Comparing version
0.1
to
0.2
+1
-1
assertlib.egg-info/PKG-INFO
Metadata-Version: 1.1
Name: assertlib
Version: 0.1
Version: 0.2
Summary: UNKNOWN

@@ -5,0 +5,0 @@ Home-page: http://www.antlong.com/

import itertools
def assertEqual(object, control):
def assertEqual(x, y):
"""
This method asserts that an object is equal to a control.
>>> assertEqual(1, 1)
>>> assertEqual(str(1), '1')
"""
if not object == control:
raise AssertionError("%s is not equal to %s" % (object, control))
if not x == y:
raise AssertionError("%s is not equal to %s" % (x, y))
def assertPrecision(object, amount):
"""
Asserts an object has x amount of precision.
def assertPrecision(object, control):
"""
This method will assert an object is precise to your control.
>>> assertPrecision(1.111, 3)
"""
if not len(str(object).partition('.')[2]) == control:
raise AssertionError("")
if not len(str(format(object)).partition('.')[2]) == int(amount):
raise AssertionError("%s does not have %s precision." % (str(object), str(amount)))
def assertEquals(object, control):
def assertEquals(x, y):
"""
This method asserts that an object is equal to a control.
This method asserts that x is equal to y.

@@ -32,8 +31,8 @@ >>> assertEquals(1, 1)

"""
assertEqual(object, control)
assertEqual(x, y)
def assertNotEqual(object, control):
def assertNotEqual(x, y):
"""
This method asserts that an object is not equal to a control.
This method asserts that x is not equal to y.

@@ -43,4 +42,4 @@ >>> assertNotEqual(1, '1')

"""
if object == control:
raise AssertionError("%s did not equal %s." % (object, control))
if x == y:
raise AssertionError("%s did not equal %s." % (x, y))

@@ -71,3 +70,3 @@

This method asserts that an object or expression evaluates to False.
>>> assertFalse(False)

@@ -82,3 +81,3 @@ """

This method asserts that an object evaluates to a control.
>>> def x():

@@ -135,4 +134,4 @@ ... return 1

'%s != %s within %s places' % (first, second, places))
def assertNotAlmostEqual(first, second, places=None, epsilon=None):

@@ -180,4 +179,14 @@ """

def assertEither(control, x, y):
"""Assert that x evaluates to either y or z."""
if control != this or control != z:
raise AssertionError("{0} is neither {1} or {2}".format(control,x,y))
def assertNotEither(control, x, y):
"""Assert that x evaluates to either y or z."""
if control == this or control == z:
raise AssertionError("{0} is neither {1} or {2}".format(control,x,y))
if __name__ == "__main__":
import doctest
doctest.testmod()
Metadata-Version: 1.1
Name: assertlib
Version: 0.1
Version: 0.2
Summary: UNKNOWN

@@ -5,0 +5,0 @@ Home-page: http://www.antlong.com/

@@ -5,3 +5,3 @@ import setuptools

name='assertlib',
version='0.1',
version='0.2',
requires=['functools'],

@@ -8,0 +8,0 @@ install_requires=['distribute'],