Registry / testing / sure
library2.0.1pypypi✓ verified 84d ago

Sure is an idiomatic assertion library for Python, designed for expressive and readable test assertions. Version 2.0.1 is current. It monkey-patches built-in types like `str`, `list`, `dict` to provide fluent assertion chains (e.g., `"hello".should.equal("hello")`). The library is in maintenance mode with sparse releases.

pip install sure
INSTALL
IMPORT
SIG · SURE
S
sure
testingpythonv2.0.1
Install
2.6s avg
Import
378ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.404s · 19.7MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.6s · import 0.352s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sure
import sure
from sure import *
Wildcard import can pollute namespace and clash with builtins
sure.anything
from sure import anything
anything is a sentinel for matching any value

Basic usage showing .should chains and the anything sentinel.

import sure def test_assertions(): # Fluent assertions via monkey-patched .should (2 + 2).should.equal(4) "hello".should.contain("ell") [1, 2, 3].should.not_.contain(4) # Using anything from sure import anything "abc".should.equal(anything) # Assert that a function raises import sys lambda: 1/0 |should| "raise(ZeroDivisionError)" # alternative syntax
Debug
Known issues
gotchasure monkey-patches built-in types globally. This can affect other libraries or test output when imported.
fix
Import sure only in test files or use a test runner that isolates imports. Alternatively, use sure's context manager to limit scope (not available in all versions).
affects: all
deprecatedThe pipe syntax (e.g., `|should|`) is deprecated and may be removed in future versions.
fix
Use the `.should` attribute syntax instead.
affects: < 2.0
breakingPython 2 support removed in v2.0. The library now requires Python 3.6+.
fix
Upgrade to Python 3.6+ if you are on an older version.
affects: >= 2.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'sure'
Sure is not installed in the current Python environment.
fix
Run `pip install sure` to install the package.
AttributeError: 'str' object has no attribute 'should'
Sure has not been imported, so the monkey-patch has not been applied.
fix
Add `import sure` at the top of your test module.
AssertionError: <some expression> should equal <value> but got <different value>
Sure's assertion mechanism raises this custom error when a predicate fails (e.g., `.should.equal()`).
fix
Check your test logic and the actual value. This is expected behavior; handle with try/except if needed.
Upgrade
Version history
2.0.1latest on PyPI · released Feb 6, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
Resources
sure — pip install sure · libregistry