GithubHelp home page GithubHelp logo

pyp-u1-c1-collections-hierarchy's Introduction

Collections Hierarchy

Node A Node is going to be the most basic element of our collections, it represents a single element in the collection. A node has two parameters on instantiation: value: This contains the value at this element next (optional): The next element in the collection after this element. If no next is provided, it should be set to None

Base Classes

Sequenceable Sequenceable collections are well... sequenceable. They have both a start and an end and you can process all the items in between in sequence. They also provide a get_elements() method to retrieve all the elements of the collection. start: This should be the first Node in the sequence and should be intialised to None end: This should be the last Node in the sequence and should be initialised to None get_elements(): returns a list containing all the values of the Nodes in the collection in order.


Appendable Collections that are appendable provide the append(element) method which adds a Node with a value of element to the end of the sequence. This method should update the start and end if necessary.


Popable Popable collections provide the pop() method which removes the first element from a sequence and returns its value. This method must also update start/end as necessary.


Pushable Pushable collections provide the push(element) method which adds a Node to the beginning of the sequence with a value of element, updating start/end when necessary.

Running Tests

# Default. Verbose if too many tests failing
$ py.test tests.py

List tests with -v

image

$ py.test -v tests.py

Control traceback with --tb

image

$ py.test -v --tb=short tests.py

Match test by name with the -k argument

image

$ py.test -v --tb=short tests.py -k test_sequenceable

Run an individual test with a "hard" reference

image

py.test -v --tb=short tests.py::test_sequenceable

Running tests with different Python Versions using Tox

Just run $ tox to run your tests for every version defined in tox.ini.

Run for a single python version with -e

image

(General syntax: tox -e[PYTHON-VERSION]). Example:

$ tox -epy27

pyp-u1-c1-collections-hierarchy's People

Contributors

jsymons avatar santiagobasulto avatar

Watchers

 avatar  avatar

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.