mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-10-30 23:47:31 +03:00 
			
		
		
		
	* Add tests for Issue #361: Lexeme rich comparison
This commit is contained in:
		
							parent
							
								
									4f46c0f398
								
							
						
					
					
						commit
						7441ca30ee
					
				
							
								
								
									
										33
									
								
								spacy/tests/vocab/test_lexeme.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								spacy/tests/vocab/test_lexeme.py
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,33 @@ | |||
| from __future__ import unicode_literals | ||||
| 
 | ||||
| import pytest | ||||
| 
 | ||||
| from spacy.attrs import * | ||||
| 
 | ||||
| 
 | ||||
| def test_lexeme_eq(en_vocab): | ||||
|     '''Test Issue #361: Equality of lexemes''' | ||||
|     cat1 = en_vocab['cat'] | ||||
| 
 | ||||
|     cat2 = en_vocab['cat'] | ||||
| 
 | ||||
|     assert cat1 == cat2 | ||||
| 
 | ||||
| def test_lexeme_neq(en_vocab): | ||||
|     '''Inequality of lexemes''' | ||||
|     cat = en_vocab['cat'] | ||||
| 
 | ||||
|     dog = en_vocab['dog'] | ||||
| 
 | ||||
|     assert cat != dog | ||||
| 
 | ||||
| def test_lexeme_lt(en_vocab): | ||||
|     '''More frequent is l.t. less frequent''' | ||||
|     noun = en_vocab['NOUN'] | ||||
| 
 | ||||
|     opera = en_vocab['opera'] | ||||
| 
 | ||||
|     print(noun.orth, opera.orth) | ||||
|     assert noun < opera | ||||
|     assert opera > noun | ||||
| 
 | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user