Mattwmaster58 commited on
Commit
de6c1b0
·
1 Parent(s): 194d4b6
Files changed (1) hide show
  1. tests/test_query.py +32 -12
tests/test_query.py CHANGED
@@ -68,9 +68,9 @@ def test_order_by(cipher_signature):
68
  """
69
  itags = [
70
  s.itag for s in cipher_signature.streams
71
- .filter(progressive=True)
72
- .order_by('itag')
73
- .all()
74
  ]
75
 
76
  assert itags == ['17', '18', '22', '36', '43']
@@ -80,31 +80,51 @@ def test_order_by_descending(cipher_signature):
80
  """Ensure :meth:`~pytube.StreamQuery.desc` sorts the list of
81
  :class:`Stream <Stream>` instances in the reverse order.
82
  """
 
83
  itags = [
84
  s.itag for s in cipher_signature.streams
85
- .filter(progressive=True)
86
- .order_by('itag')
87
- .desc()
88
- .all()
89
  ]
90
-
91
  assert itags == ['43', '36', '22', '18', '17']
92
 
 
 
 
 
 
 
 
 
 
93
 
94
  def test_order_by_ascending(cipher_signature):
95
  """Ensure :meth:`~pytube.StreamQuery.desc` sorts the list of
96
  :class:`Stream <Stream>` instances in ascending order.
97
  """
 
98
  itags = [
99
  s.itag for s in cipher_signature.streams
100
- .filter(progressive=True)
101
- .order_by('itag')
102
- .asc()
103
- .all()
104
  ]
105
 
106
  assert itags == ['17', '18', '22', '36', '43']
107
 
 
 
 
 
 
 
 
 
 
 
108
 
109
  def test_get_by_itag(cipher_signature):
110
  """Ensure :meth:`~pytube.StreamQuery.get_by_itag` returns the expected
 
68
  """
69
  itags = [
70
  s.itag for s in cipher_signature.streams
71
+ .filter(progressive=True)
72
+ .order_by('itag')
73
+ .all()
74
  ]
75
 
76
  assert itags == ['17', '18', '22', '36', '43']
 
80
  """Ensure :meth:`~pytube.StreamQuery.desc` sorts the list of
81
  :class:`Stream <Stream>` instances in the reverse order.
82
  """
83
+ # numerical values
84
  itags = [
85
  s.itag for s in cipher_signature.streams
86
+ .filter(progressive=True)
87
+ .order_by('itag')
88
+ .desc()
89
+ .all()
90
  ]
 
91
  assert itags == ['43', '36', '22', '18', '17']
92
 
93
+ # non numerical values
94
+ mime_types = [
95
+ s.mime_type for s in cipher_signature.streams
96
+ .filter(progressive=True)
97
+ .order_by('mime_type')
98
+ .desc()
99
+ .all()
100
+ ]
101
+ assert mime_types == ['video/webm', 'video/mp4', 'video/mp4', 'video/3gpp', 'video/3gpp']
102
 
103
  def test_order_by_ascending(cipher_signature):
104
  """Ensure :meth:`~pytube.StreamQuery.desc` sorts the list of
105
  :class:`Stream <Stream>` instances in ascending order.
106
  """
107
+ # numerical values
108
  itags = [
109
  s.itag for s in cipher_signature.streams
110
+ .filter(progressive=True)
111
+ .order_by('itag')
112
+ .asc()
113
+ .all()
114
  ]
115
 
116
  assert itags == ['17', '18', '22', '36', '43']
117
 
118
+ # non numerical values
119
+ mime_types = [
120
+ s.mime_type for s in cipher_signature.streams
121
+ .filter(progressive=True)
122
+ .order_by('mime_type')
123
+ .desc()
124
+ .all()
125
+ ]
126
+ assert mime_types == ['video/3gpp', 'video/3gpp', 'video/mp4', 'video/mp4', 'video/webm']
127
+
128
 
129
  def test_get_by_itag(cipher_signature):
130
  """Ensure :meth:`~pytube.StreamQuery.get_by_itag` returns the expected