Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67469

asserting the value None, please use "assert is None"

$
0
0

I am trying a hands-on, in which I am supposed to show three video on a webpage. What I have tried is working as expected on local machine but showing some warning when try to submit it online. Please let me know what i am doing wrong. Here is the html5 code.

----------------------------index.html----------------------------
<!DOCTYPE html>
<html>
<head>
  <link rel="icon" href="favicon.png" type="image/png">
  <title>Destiny</title>
  <link href="mystyle.css" rel="stylesheet" type="text/css">
</head>
<body>
  <video width="320" height="200" controls autoplay poster="https://cdn12.picryl.com/photo/2016/12/31/lego-stones-plastic-education-8b9a7d-1024.jpg" preload="auto">
  <source src="video.mp4" type="video/mp4">
  <source src="video.ogg" type="video/ogg">
  <source src="video.webm" type="video/webm">
    Your browser does not support the video tag.
  </video>

  <video width="320" height="200" controls autoplay poster="https://cdn12.picryl.com/photo/2016/12/31/lego-stones-plastic-education-8b9a7d-1024.jpg" preload="auto">
  <source src="video.mp4" type="video/mp4">
  <source src="video.ogg" type="video/ogg">
  <source src="video.webm" type="video/webm">
    Your browser does not support the video tag.
  </video>


  <video width="320" height="200" controls autoplay poster="https://cdn12.picryl.com/photo/2016/12/31/lego-stones-plastic-education-8b9a7d-1024.jpg" preload="auto">
  <source src="video.mp4" type="video/mp4">
  <source src="video.ogg" type="video/ogg">
  <source src="video.webm" type="video/webm">
    Your browser does not support the video tag.
  </video>



</body>

</html>

and here is the testing file

from bs4 import BeautifulSoup
import pytest
import pickle
import requests

class TestWebpage:
    @pytest.fixture(autouse=True)
    def get_soup(self):
        index_page = requests.get("http://localhost:8000/index.html")
        soup_index = BeautifulSoup(index_page.content, 'html.parser')
        self._index = soup_index

    # testing index.html
    def test_indexpage(self):
        site = self._index.find_all('video')
        count = 0
        for audio in site:
            count +=1
        assert count==3

        site1 = self._index.find('source',{'src':'video.mp4'})
        count = 0
        for site1 in self._index.find_all('source',{'src':'video.mp4'}):
            count +=1
        assert count==3

        assert self._index.find('video', {'autoplay': ''})
        assert self._index.find('video', {'controls': '', 'preload': ''})
        assert self._index.find('video', {'poster': 'https://cdn12.picryl.com/photo/2016/12/31/lego-stones-plastic-education-8b9a7d-1024.jpg'})

and here is the error that i m getting while running test cases

test/test_webpage.py::TestWebpage::test_indexpage

  /projects/challenge/test/test_webpage.py:28: PytestAssertRewriteWarning: asserting the value None, please use "assert is None"

    assert self._index.find('video', {'controls': '', 'preload': ''})

-- Docs: https://docs.pytest.org/en/latest/warnings.html

Note: I am allowed to edit index.html only. Tempering with testing file is not possible.


Viewing all articles
Browse latest Browse all 67469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>