{"id":22424,"library":"sure","title":"Sure","description":"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.","status":"active","version":"2.0.1","language":"python","source_language":"en","source_url":"https://github.com/gabrielfalcao/sure","tags":["testing","assertions","fluent","monkey-patching","python"],"install":[{"cmd":"pip install sure","lang":"bash","label":"Default install"}],"dependencies":[],"imports":[{"note":"Wildcard import can pollute namespace and clash with builtins","wrong":"from sure import *","symbol":"sure","correct":"import sure"},{"note":"anything is a sentinel for matching any value","symbol":"sure.anything","correct":"from sure import anything"}],"quickstart":{"code":"import sure\n\ndef test_assertions():\n    # Fluent assertions via monkey-patched .should\n    (2 + 2).should.equal(4)\n    \"hello\".should.contain(\"ell\")\n    [1, 2, 3].should.not_.contain(4)\n\n    # Using anything\n    from sure import anything\n    \"abc\".should.equal(anything)\n\n    # Assert that a function raises\n    import sys\n    lambda: 1/0 |should| \"raise(ZeroDivisionError)\"  # alternative syntax\n","lang":"python","description":"Basic usage showing .should chains and the anything sentinel."},"warnings":[{"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).","message":"sure monkey-patches built-in types globally. This can affect other libraries or test output when imported.","severity":"gotcha","affected_versions":"all"},{"fix":"Use the `.should` attribute syntax instead.","message":"The pipe syntax (e.g., `|should|`) is deprecated and may be removed in future versions.","severity":"deprecated","affected_versions":"< 2.0"},{"fix":"Upgrade to Python 3.6+ if you are on an older version.","message":"Python 2 support removed in v2.0. The library now requires Python 3.6+.","severity":"breaking","affected_versions":">= 2.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `pip install sure` to install the package.","cause":"Sure is not installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'sure'"},{"fix":"Add `import sure` at the top of your test module.","cause":"Sure has not been imported, so the monkey-patch has not been applied.","error":"AttributeError: 'str' object has no attribute 'should'"},{"fix":"Check your test logic and the actual value. This is expected behavior; handle with try/except if needed.","cause":"Sure's assertion mechanism raises this custom error when a predicate fails (e.g., `.should.equal()`).","error":"AssertionError: <some expression> should equal <value> but got <different value>"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}