This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import unittest | |
| from calculator import Calculator | |
| class TestMyCalculator(unittest.TestCase): | |
| def setUp(self): | |
| self.calc = Calculator() | |
| def test_initial_value(self): | |
| self.assertEqual(0, self.calc.value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import unittest | |
| from calculator import Calculator | |
| class TestMyCalculator(unittest.TestCase): | |
| def setUp(self): | |
| self.calc = Calculator() | |
| def test_initial_value(self): | |
| self.assertEqual(0, self.calc.value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Calculator: | |
| def __init__(self): | |
| self.value = 0 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import unittest | |
| # Importamos la clase calculadora | |
| from calculator import Calculator | |
| class TestMyCalculator(unittest.TestCase): | |
| def test_initial_value(self): | |
| calc = Calculator() | |
| self.assertEqual(0, calc.value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Calculator: | |
| pass | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Cargamos el módulo unittest | |
| import unittest | |
| # Creamos una clase heredando de TestCase | |
| class TestMyCalculator(unittest.TestCase): | |
| # Creamos una prueba para probar un valor inicial | |
| def test_initial_value(self): | |
| calc = Calculator() | |
| self.assertEqual(0, calc.value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Test plot</title> | |
| </head> | |
| <body> | |
| <h2>Gráfico embebido por imagen</h2> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import io | |
| import matplotlib.pyplot as plt | |
| from django.http import HttpResponse | |
| from django.shortcuts import render | |
| from matplotlib.backends.backend_agg import FigureCanvasAgg | |
| from random import sample | |
| def home(request): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from PyQt5.QtWidgets import QApplication, QMainWindow | |
| class MainWindow(QMainWindow): | |
| def __init__(self, *args, **kwargs): | |
| super(MainWindow, self).__init__(*args, **kwargs) | |
| self.setWindowTitle("Hola mundo") | |
| self.setFixedSize(400, 200) | |
| if __name__ == "__main__": | |
| app = QApplication([]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from PyQt5.QtWidgets import QGridLayout, QMainWindow, QWidget, QApplication, QLineEdit, QLabel | |
| from PyQt5.QtGui import QIntValidator | |
| class MainWindow(QMainWindow): | |
| def __init__(self, *args, **kwargs): | |
| super(MainWindow, self).__init__(*args, **kwargs) | |
| self.setWindowTitle("Regla de 3") | |
| self.setupUi() | |
| def setupUi(self): |