pyffi | Python library for processing block structured files

 by   niftools Python Version: Current License: Non-SPDX

kandi X-RAY | pyffi Summary

kandi X-RAY | pyffi Summary

null

PyFFI is a Python library for processing block structured files.
Support
    Quality
      Security
        License
          Reuse

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of pyffi
            Get all kandi verified functions for this library.

            pyffi Key Features

            No Key Features are available at this moment for pyffi.

            pyffi Examples and Code Snippets

            No Code Snippets are available at this moment for pyffi.

            Community Discussions

            QUESTION

            Clarification of Test Driven Development in Python
            Asked 2021-Jan-11 at 06:16

            I am wondering if I can get some clarification on TDD and just Testing in general. I'm using python to write my program, and pytest as my testing framework.

            So far, the way I have been doing it, writing these tests first, has started to get my brain to take a pragmatic approach towards certain tasks.

            1. Everything apart from 3 class variables were written before the tests were written, does that mean I'm technically not following TDD?
            2. Just for clarity, am I supposed to write the entire test for an unimplemented method first, then create the method and functionality so the tests pass?
            3. Is my main objective following TDD to have every single test pass, no matter what I change in the test data?(Which it does)(hence eliminating the potential for bugs?)
            4. Are tests for a class supposed to number greatly(depending on the size of the class)?
            5. Based on the code below, can you tell me if I am on the correct path

            Code for your reference

            ...

            ANSWER

            Answered 2021-Jan-11 at 06:16

            Everything apart from 3 class variables were written before the tests were written, does that mean I'm technically not following TDD?

            If you are writing any "real" code before you have a test that needs it, then you aren't following TDD. That can be OK - TDD isn't necessarily the best tool to use in all situations. But when you are in a situation where TDD makes sense, then the test is written first.

            am I supposed to write the entire test for an unimplemented method first, then create the method and functionality so the tests pass?

            It depends on whose guidance you are following. Robert Martin advises that you write just enough of the test for it to fail, and then make that much pass, then write more test, then make that pass, and so on, until the test is complete. He called this the nano cycle. Martin suggested this as a technique for reproducing the experience of working with Kent Beck.

            However, when Kent Beck himself describes TDD, he talks about writing one complete test, and then fixing the problems in it one at a time.

            I myself find that Beck's style works better for me, especially in a coding environment that can automatically fill some of the missing code. So I'll concentrate exclusively on the design of the test until I am satisfied with it, then let the IDE create the skeleton code I will need to pass the test, and the finally fill in the details.

            Is my main objective following TDD to have every single test pass

            Tests are really "mistake detectors"; the objective is to create code that delivers value without mistakes.

            One of the benefits of TDD is that the ritual greatly reduces the number of "mistakes" you have to deal with at any one time. And yes, that means that the discipline is that we are almost always in one of two states, either (a) all of the tests we have written are passing, or (b) all except one of the test we have written are passing.

            Are tests for a class supposed to number greatly(depending on the size of the class)?

            Not necessarily size; complexity might be a better gauge - how many different input classes are there? You will normally need at least one sample from each to ensure that all of the behaviors you need are present.

            A common illustration here: imagine a function that takes a Gregorian year as input, and returns true if that year is a leap year. The input classes we care about

            • year not divisible by 4
            • year divisible by 4, but not by 100
            • year divisible by 100, but not by 400
            • year divisible by 400

            So four "tests"?

            can you tell me if I am on the correct path

            Hard to say. There are a couple ideas that stand out, however.

            Most real work includes both "code that is complicated" and "code that is hard to test". One useful trick is to design your code so that the complicated code is easy to test, and the code that is hard to test is so simple that there are obviously no deficiencies.

            "Hard to test" includes behaviors that depend on shared mutable state (like a file system). So we'll often choose designs where the file system code is too simple to break, put all the branching somewhere else, and then thoroughly test the branching code.

            Furthermore, test design is a thing. In particular, we normally want to prioritize making the tests easy to understand at a glance. This in turn will often mean that you'll keep all of the code for one test together, rather than having a bunch of "set up" code in one place and your asserts somewhere else.

            Source https://stackoverflow.com/questions/65661437

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install pyffi

            No Installation instructions are available at this moment for pyffi.Refer to component home page for details.

            Support

            For feature suggestions, bugs create an issue on GitHub
            If you have any questions vist the community on GitHub, Stack Overflow.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries