Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8904508

Browse files
committed
Fixed Python doc strings and other formatting/naming/Pep8
1 parent b1cb22c commit 8904508

File tree

2 files changed

+98
-360
lines changed

2 files changed

+98
-360
lines changed

plotly/tests/test_optional/test_figure_factory.py

Lines changed: 51 additions & 323 deletions
Original file line numberDiff line numberDiff line change
@@ -636,339 +636,67 @@ def test_trisurf_all_args(self):
636636
tri = Delaunay(points2D)
637637
simplices = tri.simplices
638638

639-
test_trisurf_plot = tls.FigureFactory.create_trisurf(x, y, z, simplices)
640-
641-
"""
642639
test_trisurf_plot = tls.FigureFactory.create_trisurf(
643-
x, y, z, simplices, colormap=[(0, 0, 0), (1, 1, 1)],
644-
title='Fun',
645-
showbackground=False,
646-
backgroundcolor='rgb(1, 1, 1)',
647-
gridcolor='rgb(2, 2, 2)',
648-
zerolinecolor='rgb(3, 3, 3)',
649-
height=500, width=500,
650-
aspectratio=dict(x=0.7, y=0.6, z=1.2)
640+
x, y, z, simplices
651641
)
652-
"""
653642

654-
exp_trisurf_plot = {'data': [{'facecolor': ['rgb(143.0, 123.0, 97.000000000000014)',
643+
exp_trisurf_plot = {
644+
'data': [
645+
{
646+
'facecolor': ['rgb(143.0, 123.0, 97.000000000000014)',
655647
'rgb(255.0, 127.0, 14.000000000000007)',
656648
'rgb(143.0, 123.0, 97.000000000000014)',
657649
'rgb(31.0, 119.0, 180.0)',
658650
'rgb(143.0, 123.0, 97.000000000000014)',
659651
'rgb(31.0, 119.0, 180.0)',
660652
'rgb(143.0, 123.0, 97.000000000000014)',
661653
'rgb(255.0, 127.0, 14.000000000000007)'],
662-
'i': [3, 1, 1, 5, 7, 3, 5, 7],
663-
'j': [1, 3, 5, 1, 3, 7, 7, 5],
664-
'k': [4, 0, 4, 2, 4, 6, 4, 8],
665-
'name': '',
666-
'type': 'mesh3d',
667-
'x': np.array([-1., 0., 1., -1., 0., 1., -1., 0., 1.]),
668-
'y': np.array([-1., -1., -1., 0., 0., 0., 1., 1., 1.]),
669-
'z': np.array([ 1., -0., -1., -0., 0., 0., -1., 0., 1.])},
670-
{'line': {'color': 'rgb(50, 50, 50)', 'width': 1.5},
671-
'mode': 'lines',
672-
'type': 'scatter3d',
673-
'x': [-1.0,
674-
0.0,
675-
0.0,
676-
-1.0,
677-
None,
678-
0.0,
679-
-1.0,
680-
-1.0,
681-
0.0,
682-
None,
683-
0.0,
684-
1.0,
685-
0.0,
686-
0.0,
687-
None,
688-
1.0,
689-
0.0,
690-
1.0,
691-
1.0,
692-
None,
693-
0.0,
694-
-1.0,
695-
0.0,
696-
0.0,
697-
None,
698-
-1.0,
699-
0.0,
700-
-1.0,
701-
-1.0,
702-
None,
703-
1.0,
704-
0.0,
705-
0.0,
706-
1.0,
707-
None,
708-
0.0,
709-
1.0,
710-
1.0,
711-
0.0,
712-
None],
713-
'y': [0.0,
714-
-1.0,
715-
0.0,
716-
0.0,
717-
None,
718-
-1.0,
719-
0.0,
720-
-1.0,
721-
-1.0,
722-
None,
723-
-1.0,
724-
0.0,
725-
0.0,
726-
-1.0,
727-
None,
728-
0.0,
729-
-1.0,
730-
-1.0,
731-
0.0,
732-
None,
733-
1.0,
734-
0.0,
735-
0.0,
736-
1.0,
737-
None,
738-
0.0,
739-
1.0,
740-
1.0,
741-
0.0,
742-
None,
743-
0.0,
744-
1.0,
745-
0.0,
746-
0.0,
747-
None,
748-
1.0,
749-
0.0,
750-
1.0,
751-
1.0,
752-
None],
753-
'z': [-0.0,
754-
-0.0,
755-
0.0,
756-
-0.0,
757-
None,
758-
-0.0,
759-
-0.0,
760-
1.0,
761-
-0.0,
762-
None,
763-
-0.0,
764-
0.0,
765-
0.0,
766-
-0.0,
767-
None,
768-
0.0,
769-
-0.0,
770-
-1.0,
771-
0.0,
772-
None,
773-
0.0,
774-
-0.0,
775-
0.0,
776-
0.0,
777-
None,
778-
-0.0,
779-
0.0,
780-
-1.0,
781-
-0.0,
782-
None,
783-
0.0,
784-
0.0,
785-
0.0,
786-
0.0,
787-
None,
788-
0.0,
789-
0.0,
790-
1.0,
791-
0.0,
792-
None]}],
793-
'layout': {'height': 800,
794-
'scene': {'aspectratio': {'x': 1, 'y': 1, 'z': 1},
795-
'xaxis': {'backgroundcolor': 'rgb(230, 230, 230)',
796-
'gridcolor': 'rgb(255, 255, 255)',
797-
'showbackground': True,
798-
'zerolinecolor': 'rgb(255, 255, 255)'},
799-
'yaxis': {'backgroundcolor': 'rgb(230, 230, 230)',
800-
'gridcolor': 'rgb(255, 255, 255)',
801-
'showbackground': True,
802-
'zerolinecolor': 'rgb(255, 255, 255)'},
803-
'zaxis': {'backgroundcolor': 'rgb(230, 230, 230)',
804-
'gridcolor': 'rgb(255, 255, 255)',
805-
'showbackground': True,
806-
'zerolinecolor': 'rgb(255, 255, 255)'}},
807-
'title': 'Trisurf Plot',
808-
'width': 800}}
809-
810-
811-
"""
812-
exp_trisurf_plot = {'data': [{'facecolor': ['rgb(127.5, 127.5, 127.5)',
813-
'rgb(255.0, 255.0, 255.0)',
814-
'rgb(127.5, 127.5, 127.5)',
815-
'rgb(0.0, 0.0, 0.0)',
816-
'rgb(127.5, 127.5, 127.5)',
817-
'rgb(0.0, 0.0, 0.0)',
818-
'rgb(127.5, 127.5, 127.5)',
819-
'rgb(255.0, 255.0, 255.0)'],
820-
'i': [3, 1, 1, 5, 7, 3, 5, 7],
821-
'j': [1, 3, 5, 1, 3, 7, 7, 5],
822-
'k': [4, 0, 4, 2, 4, 6, 4, 8],
823-
'name': '',
824-
'type': 'mesh3d',
825-
'x': np.array([-1., 0., 1., -1., 0., 1., -1., 0., 1.]),
826-
'y': np.array([-1., -1., -1., 0., 0., 0., 1., 1., 1.]),
827-
'z': np.array([ 1., -0., -1., -0., 0., 0., -1., 0., 1.])},
828-
{'line': {'color': 'rgb(50, 50, 50)', 'width': 1.5},
829-
'mode': 'lines',
830-
'type': 'scatter3d',
831-
'x': [-1.0,
832-
0.0,
833-
0.0,
834-
-1.0,
835-
None,
836-
0.0,
837-
-1.0,
838-
-1.0,
839-
0.0,
840-
None,
841-
0.0,
842-
1.0,
843-
0.0,
844-
0.0,
845-
None,
846-
1.0,
847-
0.0,
848-
1.0,
849-
1.0,
850-
None,
851-
0.0,
852-
-1.0,
853-
0.0,
854-
0.0,
855-
None,
856-
-1.0,
857-
0.0,
858-
-1.0,
859-
-1.0,
860-
None,
861-
1.0,
862-
0.0,
863-
0.0,
864-
1.0,
865-
None,
866-
0.0,
867-
1.0,
868-
1.0,
869-
0.0,
870-
None],
871-
'y': [0.0,
872-
-1.0,
873-
0.0,
874-
0.0,
875-
None,
876-
-1.0,
877-
0.0,
878-
-1.0,
879-
-1.0,
880-
None,
881-
-1.0,
882-
0.0,
883-
0.0,
884-
-1.0,
885-
None,
886-
0.0,
887-
-1.0,
888-
-1.0,
889-
0.0,
890-
None,
891-
1.0,
892-
0.0,
893-
0.0,
894-
1.0,
895-
None,
896-
0.0,
897-
1.0,
898-
1.0,
899-
0.0,
900-
None,
901-
0.0,
902-
1.0,
903-
0.0,
904-
0.0,
905-
None,
906-
1.0,
907-
0.0,
908-
1.0,
909-
1.0,
910-
None],
911-
'z': [-0.0,
912-
-0.0,
913-
0.0,
914-
-0.0,
915-
None,
916-
-0.0,
917-
-0.0,
918-
1.0,
919-
-0.0,
920-
None,
921-
-0.0,
922-
0.0,
923-
0.0,
924-
-0.0,
925-
None,
926-
0.0,
927-
-0.0,
928-
-1.0,
929-
0.0,
930-
None,
931-
0.0,
932-
-0.0,
933-
0.0,
934-
0.0,
935-
None,
936-
-0.0,
937-
0.0,
938-
-1.0,
939-
-0.0,
940-
None,
941-
0.0,
942-
0.0,
943-
0.0,
944-
0.0,
945-
None,
946-
0.0,
947-
0.0,
948-
1.0,
949-
0.0,
950-
None]}],
951-
'layout': {'height': 500,
952-
'scene': {'aspectratio': {'x': 0.7, 'y': 0.6, 'z': 1.2},
953-
'xaxis': {'backgroundcolor': 'rgb(1, 1, 1)',
954-
'gridcolor': 'rgb(2, 2, 2)',
955-
'showbackground': False,
956-
'zerolinecolor': 'rgb(3, 3, 3)'},
957-
'yaxis': {'backgroundcolor': 'rgb(1, 1, 1)',
958-
'gridcolor': 'rgb(2, 2, 2)',
959-
'showbackground': False,
960-
'zerolinecolor': 'rgb(3, 3, 3)'},
961-
'zaxis': {'backgroundcolor': 'rgb(1, 1, 1)',
962-
'gridcolor': 'rgb(2, 2, 2)',
963-
'showbackground': False,
964-
'zerolinecolor': 'rgb(3, 3, 3)'}},
965-
'title': 'Fun',
966-
'width': 500}}
967-
"""
968-
969-
print(test_trisurf_plot)
970-
971-
print(exp_trisurf_plot)
654+
'i': [3, 1, 1, 5, 7, 3, 5, 7],
655+
'j': [1, 3, 5, 1, 3, 7, 7, 5],
656+
'k': [4, 0, 4, 2, 4, 6, 4, 8],
657+
'name': '',
658+
'type': 'mesh3d',
659+
'x': np.array([-1., 0., 1., -1., 0., 1., -1., 0., 1.]),
660+
'y': np.array([-1., -1., -1., 0., 0., 0., 1., 1., 1.]),
661+
'z': np.array([ 1., -0., -1., -0., 0., 0., -1., 0., 1.])
662+
},
663+
{
664+
'line': {'color': 'rgb(50, 50, 50)', 'width': 1.5},
665+
'mode': 'lines',
666+
'type': 'scatter3d',
667+
'x': [-1.0, 0.0, 0.0, -1.0, None, 0.0, -1.0, -1.0, 0.0, None,
668+
0.0, 1.0, 0.0, 0.0, None, 1.0, 0.0, 1.0, 1.0, None, 0.0,
669+
-1.0, 0.0, 0.0, None, -1.0, 0.0, -1.0, -1.0, None, 1.0,
670+
0.0, 0.0, 1.0, None, 0.0, 1.0, 1.0, 0.0, None],
671+
'y': [0.0, -1.0, 0.0, 0.0, None, -1.0, 0.0, -1.0, -1.0, None,
672+
-1.0, 0.0, 0.0, -1.0, None, 0.0, -1.0, -1.0, 0.0, None,
673+
1.0, 0.0, 0.0, 1.0, None, 0.0, 1.0, 1.0, 0.0, None, 0.0,
674+
1.0, 0.0, 0.0, None, 1.0, 0.0, 1.0, 1.0, None],
675+
'z': [-0.0, -0.0, 0.0, -0.0, None, -0.0, -0.0, 1.0, -0.0,
676+
None, -0.0, 0.0, 0.0, -0.0, None, 0.0, -0.0, -1.0, 0.0,
677+
None, 0.0, -0.0, 0.0, 0.0, None, -0.0, 0.0, -1.0, -0.0,
678+
None, 0.0, 0.0, 0.0, 0.0, None, 0.0, 0.0, 1.0, 0.0, None]
679+
}
680+
],
681+
'layout': {
682+
'height': 800,
683+
'scene': {'aspectratio': {'x': 1, 'y': 1, 'z': 1},
684+
'xaxis': {'backgroundcolor': 'rgb(230, 230, 230)',
685+
'gridcolor': 'rgb(255, 255, 255)',
686+
'showbackground': True,
687+
'zerolinecolor': 'rgb(255, 255, 255)'},
688+
'yaxis': {'backgroundcolor': 'rgb(230, 230, 230)',
689+
'gridcolor': 'rgb(255, 255, 255)',
690+
'showbackground': True,
691+
'zerolinecolor': 'rgb(255, 255, 255)'},
692+
'zaxis': {'backgroundcolor': 'rgb(230, 230, 230)',
693+
'gridcolor': 'rgb(255, 255, 255)',
694+
'showbackground': True,
695+
'zerolinecolor': 'rgb(255, 255, 255)'}},
696+
'title': 'Trisurf Plot',
697+
'width': 800
698+
}
699+
}
972700

973701
self.assert_dict_equal(test_trisurf_plot['layout'],
974702
exp_trisurf_plot['layout'])

0 commit comments

Comments
 (0)