Giter VIP home page Giter VIP logo

prettytests.jl's Introduction

PrettyTests.jl

Dev Build Status

A Julia package that provides @test-like macros with more informative error messages.

The inspiration comes from python asserts, which customize their error message based on the type of unit test being performed; for example, by showing the differences between two sets or lists that should be equal.

PrettyTests exports drop-in replacements for @test that are designed to (a) provide concise error messages tailored to specific situations, and (b) conform with the standard Test interface so that they fit into to any unit-testing workflow.

Installation

The package requires Julia 1.7 or higher. It can be installed using Julia's package manager: first type ] in the REPL, then:

pkg> add PrettyTests

Example Usage

julia> @test_all [1, 2, 3] .< 2
Test Failed at none:1
  Expression: all([1, 2, 3] .< 2)
   Evaluated: false
    Argument: 3-element BitVector, 2 failures:
              [2]: 2 < 2 ===> false
              [3]: 3 < 2 ===> false

julia> @test_sets [1, 2, 3] ∩ [2, 3, 4] == ∅
Test Failed at none:1
  Expression: [1, 2, 3] ∩ [2, 3, 4] == ∅
   Evaluated: L and R are not disjoint.
              L ∩ R has 2 elements: [2, 3]

More details and functionalities are listed in the package documentation.

prettytests.jl's People

Contributors

tpapalex avatar dependabot[bot] avatar

Stargazers

Dennis Ogiermann avatar Uwe Hernandez Acosta avatar Jeffrey Sarnoff avatar Anshul Singhvi avatar Jean-Francois Baffier avatar

Watchers

 avatar

prettytests.jl's Issues

@test_all Symbol assertion

Various lines in @test_all have an inline ex.args[1]::Symbol assertions for expressions with a :call or :. head (e.g. line 82, 92).

These assertions should be removed, as they will error when an expression call is to a module function.

Add @test_sorted

New macro:

@test_sorted itr [by=...] [lt=...] [rev=...]

should act like issorted(itr, by=by, lt=lt)

On failure, should list the index (key or state) at which the iterable was not ordered, along with the by transformation and lt call result that was unordered.

Code improvements

Make code more readable, use dispatch more effectively, clean up utility functions

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.