$ add-apt-repository universe
$ apt-get update
$ apt-get upgrade
$ apt-get install python3 nginx supervisor # postgresql postgresql-contrib (si no se quiere sqlite)
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) |
class Calculator: | |
def __init__(self): | |
self.value = 0 | |
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) |
class Calculator: | |
pass | |
# 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) |
<!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> |
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): |
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([]) |
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): |