Git Product home page Git Product logo

pythonlearner's Introduction

pythonlearner

import unittest from survey import AnonymousSurvey

class TestAnonymousSurvey(unittest.TestCase): """针对AnonymousSurvey类的测试"""

def setUp(self):
    """创建一个调查对象和一组答案,供使用的测试方法使用"""
    question = "What language did you first learn to speak?"
    self.my_survey = AnonymousSurvey(question)
    self.responses = ['English', 'Spanish', 'Mandarin']

def test_store_single_response(self):
    """测试单个答案会被妥善处理"""
    self.my_survey.store_response(self.responses[0])
    self.assertIn(self.responses[0], self.my_survey.responses)

def test_store_three_responses(self):
    """测试三个答案会被妥善存储"""
    for response in self.responses:
        self.my_survey.store_response(response)
    for response in self.responses:
        self.assertIn(response, self.my_survey.responses)

if name == 'main': unittest.main()

#results

usage: setup.py [-h] [-v] [-q] [--locals] [-f] [-c] [-b] [-k TESTNAMEPATTERNS] [tests [tests ...]] setup.py: error: unrecognized arguments: --command-packages

Process finished with exit code 2

pythonlearner's People

Contributors

lydia0101 avatar

Watchers

 avatar

pythonlearner's Issues

unittest error

follow the instruction of Python Crash Course, but the result shown in Pycharm isn't true

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.