@@ -33,6 +33,7 @@ def test_simple(self):
3333 )
3434 r .close ()
3535 self .assertTrue (1 , parser .component_count ())
36+ self .assertFalse (parser .has_warnings ())
3637
3738 def test_example_1 (self ):
3839 with open (os .path .join (os .path .dirname (__file__ ), 'fixtures/requirements-example-1.txt' )) as r :
@@ -41,6 +42,7 @@ def test_example_1(self):
4142 )
4243 r .close ()
4344 self .assertTrue (3 , parser .component_count ())
45+ self .assertFalse (parser .has_warnings ())
4446
4547 def test_example_with_comments (self ):
4648 with open (os .path .join (os .path .dirname (__file__ ), 'fixtures/requirements-with-comments.txt' )) as r :
@@ -49,6 +51,7 @@ def test_example_with_comments(self):
4951 )
5052 r .close ()
5153 self .assertTrue (5 , parser .component_count ())
54+ self .assertFalse (parser .has_warnings ())
5255
5356 def test_example_multiline_with_comments (self ):
5457 with open (os .path .join (os .path .dirname (__file__ ), 'fixtures/requirements-multilines-with-comments.txt' )) as r :
@@ -57,6 +60,7 @@ def test_example_multiline_with_comments(self):
5760 )
5861 r .close ()
5962 self .assertTrue (5 , parser .component_count ())
63+ self .assertFalse (parser .has_warnings ())
6064
6165 @unittest .skip ('Not yet supported' )
6266 def test_example_with_hashes (self ):
@@ -66,3 +70,14 @@ def test_example_with_hashes(self):
6670 )
6771 r .close ()
6872 self .assertTrue (5 , parser .component_count ())
73+ self .assertFalse (parser .has_warnings ())
74+
75+ def test_example_without_pinned_versions (self ):
76+ with open (os .path .join (os .path .dirname (__file__ ), 'fixtures/requirements-without-pinned-versions.txt' )) as r :
77+ parser = RequirementsParser (
78+ requirements_content = r .read ()
79+ )
80+ r .close ()
81+ self .assertTrue (2 , parser .component_count ())
82+ self .assertTrue (parser .has_warnings ())
83+ self .assertEqual (3 , len (parser .get_warnings ()))
0 commit comments