Ejemplo n.º 1
0
# This entrypoint file to be used in development. Start by reading README.md
import shape_calculator
from unittest import main


rect = shape_calculator.Rectangle(10, 5)
print(rect.get_area())
rect.set_height(3)
print(rect.get_perimeter())
print(rect)
print(rect.get_picture())
 
sq = shape_calculator.Square(9)
print(sq.get_area())
sq.set_side(4)
print(sq.get_diagonal())
print(sq)
print(sq.get_picture())
 
rect.set_height(8)
rect.set_width(16)


print(rect.get_amount_inside(sq))
Ejemplo n.º 2
0
 def test_get_amount_inside_none(self):
     rect2 = shape_calculator.Rectangle(2, 3)
     actual = rect2.get_amount_inside(self.rect)
     expected = 0
     self.assertEqual(actual, expected,
                      'Expected `get_amount_inside` to return 0.')
Ejemplo n.º 3
0
 def setUp(self):
     self.rect = shape_calculator.Rectangle(3, 6)
     self.sq = shape_calculator.Square(5)
Ejemplo n.º 4
0
# This entrypoint file to be used in development.
import shape_calculator
from unittest import main


rect = shape_calculator.Rectangle(5, 10)
print(rect.get_area())
rect.set_width(3)
print(rect.get_perimeter())
print(rect)

sq = shape_calculator.Square(9)
print(sq.get_area())
sq.set_side(4)
print(sq.get_diagonal())
print(sq)


# Run unit tests automatically
main(module='test_module', exit=False)
Ejemplo n.º 5
0
 def test_get_amount_inside_two_rectangles(self):
     rect2 = shape_calculator.Rectangle(4, 8)
     actual = rect2.get_amount_inside(self.rect)
     expected = 1
     self.assertEqual(actual, expected,
                      'Expected `get_amount_inside` to return 1.')
Ejemplo n.º 6
0
# This entrypoint file to be used in development. Start by reading README.md
import shape_calculator
from unittest import main

rect = shape_calculator.Rectangle(16, 8)
print(rect)
print(rect.get_area())
rect.set_width(3)
print(rect.get_perimeter())
print(rect)
#
sq = shape_calculator.Square(9)
print(sq)
print(sq.get_area())
sq.set_side(4)
print(sq.get_diagonal())
print(sq)

# Run unit tests automatically
main(module='test_module', exit=False)
Ejemplo n.º 7
0
# This entrypoint file to be used in development. Start by reading README.md
import shape_calculator
from unittest import main


rect = shape_calculator.Rectangle(5, 10)
print(rect.get_area())
rect.set_width(8)
print(rect.get_perimeter())
print(rect)
print(rect.get_picture())
print (rect.get_amount_inside(shape_calculator.Rectangle(11,5)))
sq = shape_calculator.Square(9)
print(sq.get_area())
sq.set_side(4)
print(sq.get_diagonal())
print(sq)
 

# Run unit tests automatically
main(module='test_module', exit=False)
Ejemplo n.º 8
0
# This entrypoint file to be used in development. Start by reading README.md
import shape_calculator
from unittest import main

rect = shape_calculator.Rectangle(3, 6)
sq = shape_calculator.Square(5)

rect.set_width(7)
rect.set_height(8)
sq.set_side(2)
print(str(rect))
#expected = "Rectangle(width=7, height=8)"
print(str(sq))
#expected = "Square(side=2)"

sq.set_width(4)
print(str(sq))
#expected = "Square(side=4)"

# Run unit tests automatically
main(module='test_module', exit=False)
Ejemplo n.º 9
0
# This entrypoint file to be used in development. Start by reading README.md
import shape_calculator
from unittest import main

rect = shape_calculator.Rectangle(5, 10)
print(rect.get_area())
rect.set_width(3)
print(rect.get_perimeter())
print(rect)
print(rect.get_picture())
sq = shape_calculator.Square(9)
print(sq.get_area())
sq.set_side(4)
print(sq.get_diagonal())
print(sq)
print(sq.get_picture())
print(rect.get_amount_inside(sq))
rect2 = shape_calculator.Rectangle(22, 13)
print(rect2.get_amount_inside(rect))

rect = shape_calculator.Rectangle(3, 6)
sq = shape_calculator.Square(5)
print(rect.get_diagonal())
print(sq.get_diagonal())

# Run unit tests automatically
main(module='test_module', exit=False)
Ejemplo n.º 10
0
# This entrypoint file to be used in development. Start by reading README.md
import shape_calculator
from unittest import main

rect = shape_calculator.Rectangle(4, 8)
rect2 = shape_calculator.Rectangle(3, 6)

print(rect.get_amount_inside(rect2))

# Run unit tests automatically
main(module='test_module', exit=False)