GithubHelp home page GithubHelp logo

language-python-test's Introduction

Introduction

A test suite for the Haskell library language-python (a parser for Python 2 and 3).

License

language-python-test is released as open source software under the terms of the 3 clause BSD License. See the file LICENCE.txt in the source code repository of language-python-test.

This package also contains files from the CPython test suite. Those files are found in the sub-directories test/CPython_test_suite_v2 and test/CPython_test_suite_v3. The license for those files is contained in those directories.

Installation

Install into a cabal sandbox:

git clone https://github.com/bjpop/language-python-test/
cd language-python-test
cabal sandbox init
cabal install language-python-test
# perhaps copy the executables from language_python_test/.cabal-sandbox/bin to ~/.cabal/bin/
# and run cabal sandbox delete to remove the sandbox files

Usage

The package builds the following executable programs:

  • language-python-parse-pretty
  • language-python-roundtrip
  • language-python-tokens

The first program parses a Python file as input and pretty prints it back again.

The second program performs a round-trip of parse, pretty print, parse and pretty print. It checks that the first pretty print is equal to the second pretty print. This is not a perfect test for correctness, but it does check that the parser and pretty printer agree to some extent, and is usually quite good at finding errors.

The third program performs lexical analysis on the input Python file and pretty prints the resulting token stream.

The test suite (which tests the behaviour of language-python) uses the shelltest tool. To run the tests you need to have shelltest installed:

cabal install shelltestrunner

The tests are found in the sub-directory called tests.

You can run the tests like so from the top directory of the language-python-test package:

shelltest --color --execdir test/ -- -j1

If you have installed into a cabal sandbox, then you might need to adjust your path:

PATH=.cabal-sandbox/bin/:$PATH shelltest --color --execdir test/ -- -j1 

We provide a Makefile for convenience which does the same thing. You can run it like so:

make test

or, with PATH adjustment:

PATH=.cabal-sandbox/bin/:$PATH make test 

language-python-test's People

Contributors

bjpop avatar garetht avatar

Stargazers

Alexandre Souza avatar Daniel Kahlenberg avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

garetht

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.